Happy game
Limits: 2 sec., 1024 MiB
This statement was translated automatically from Ukrainian.
Marichka and Zenyk are playing a game. They take turns writing a certain symbol on the board. Marichka can write 4 or 7, and Zenyk can write + or *. Marichka makes the first move, and the game continues until Marichka writes \(n\) digits.
If the value of the written expression gives a remainder of \(r\) when divided by \(k\), then Marichka wins, otherwise — Zenyk.
Tell who wins if both players play optimally. Note that multiplication has higher precedence than addition, as usual.
Input
The first line contains three integers \(n\), \(k\) and \(r\).
Output
In a single line output Marichka if Marichka wins, and
Zenyk otherwise.
Constraints
\(1 \le n \le 10^5\),
\(0 \le r < k \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 11 0 | Zenyk |
| Input (stdin) | Output (stdout) |
|---|---|
| 2 8 0 | Marichka |
| Input (stdin) | Output (stdout) |
|---|---|
| 3 35 21 | Marichka |
Notes
In the first example, Zenyk can place *, then the expression can only take one of the values \(16\), \(28\), \(49\), none of which is divisible by \(11\).
In the second example, Marichka can place two fours, then regardless of Zenyk’s choice, the value of the expression will be divisible by \(8\).
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|