Rectangle Cutting#11722

Rectangle Cutting

1 segundo
128 megabytes
Muy fácil (≈850)

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.

Entrada

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

Salida

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

Ejemplos

Ejemplo 1

Loading
Loading

Ejemplo 2

Loading
Loading