Rectangle Cutting#11722

Rectangle Cutting

1 second
128 megabytes
Very easy

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.

Input

Two integers and b~(1 \le a, b \le 500).

Output

Print the minimum number of moves required to cut the rectangle into squares.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading