eolymp
bolt
Try our new interface for solving problems
Problems

Vasya and his friends

Vasya and his friends

In the new game "Clossed Loops 7" offers players a checkered table \textbf{N} to \textbf{M} cells. The course consists in the fact that another player draws a \textit{loop} - closed curve without self-intersections, running only on the sides of the cells. Each cycle can be drawn only once for the entire game (in this case, of course, there is no draw cycles, overlapping with the already painted). Players take turns. Vyigryvat one who draws the last possible cycle. For example, if \textbf{N = 2}, \textbf{M = 1}, then only three cycles, and the player making the third turn, wins: \includegraphics{https://static.e-olymp.com/content/22/22604df1f6bbe200cb80415d224d63ed2986c936.jpg} Vasya called the \textbf{K-1} friends to play with him. To make an impression, he would want to win. For this he needs to know how the account is a player he must be guaranteed to win. Vasya heard about your success in programming, and for help, he turned it to you. \InputFile Given three integers: \textbf{N}, \textbf{M} - the table size (\textbf{1} ≤ \textbf{N} ≤ \textbf{100}, \textbf{1} ≤ \textbf{M} ≤ \textbf{8}) and \textbf{K} - the number of players (\textbf{1} < \textbf{K} ≤ \textbf{10^9}). \OutputFile Bring one number from \textbf{1} to \textbf{K} - what a player account to be Vasya to win.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
2 1 2
Output example #1
1