370. Rifleman

Time limit per test: 0.75 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Petya is a rifleman. He is located in the leftmost bottom cell of the rectangular field Nx M, all other cells of the field are occupied by enemies. Petya and his enemies are points and they are located in the centers of the corresponding cells. Petya has a power supersecret weapon Ber-9875 which destroys all enemies along a straight line. Your task is to calculate the minimum number of shots to do this.

Input
The first line of the input contains two integers N and M (1≤ N, M≤ 106).

Output
Output file must contain the minimum number of shots.

Example(s)
sample input
sample output
3 4
7

sample input
sample output
2 10
11




Online Contester Team © 2002 - 2010. All rights reserved.