eolymp
bolt
Try our new interface for solving problems
Problems

Queen of angle

Queen of angle

In the lower left corner of the board \textbf{M}×\textbf{N} is the queen. Two players take turns walking the queen, moving it to any number of cells vertically upwards, horizontally to the right, or diagonally to the right and upwards. The winner is the one who put the queen in the top right corner of the board. Determine which of the players has a winning strategy. \InputFile The input to the program of fed two natural numbers \textbf{M} and \textbf{N}, not exceeding \textbf{100}. \OutputFile The program should print player number (\textbf{1} or \textbf{2}) who has a winning strategy.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3 4
Output example #1
1