cho.sh
Notes
Loading...

Diagonal Across Tiles

Time limit

1s

Memory limit

128 MB

Problem

Unit square tiles with side length 1cm are used to fill an xcm by ycm rectangular wall without gaps. x and y are positive integers.

A diagonal is drawn from one corner of the rectangle to the opposite corner. Among all x * y tiles, determine how many tiles the diagonal passes through.

Input

The first line contains the rectangle width x and height y. x and y are positive integers no greater than 1,000,000,000, and there is at least one space between them.

Output

Print the number of tiles that the diagonal passes through.