A rectangle of size a \times b is given. Your task is to cut it into squares. In one move, you can select one of the rectangles and split it into two new rectangles so that all side lengths remain integers. Determine the minimum number of moves required to complete this task.
Two integers and b~(1 \le a, b \le 500).
Print the minimum number of moves required to cut the rectangle into squares.
Example 1
Example 2