Time limit
1s
Memory limit
128 MB
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.
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.
Print the number of tiles that the diagonal passes through.