ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1139. City Blocks

Time limit: 1.0 second
Memory limit: 64 MB
The blocks in the city of Fishburg are of square form. N avenues running south to north and M streets running east to west bound them. A helicopter took off in the most southwestern crossroads and flew along the straight line to the most northeastern crossroads. How many blocks did it fly above?
Note. A block is a square of minimum area (without its borders).

Input

The input contains N and M separated by one or more spaces. 1 < N, M < 32000.

Output

The number of blocks the helicopter flew above.

Samples

inputoutput
4 3
4
3 3
2

Notes

The figures for samples:
Problem illustration
Problem Source: Quarterfinal, Central region of Russia, Rybinsk, October 17-18 2001