Cinema+#4753

Cinema+

1 second
128 megabytes
Medium

Once, the pupils of the B-th school of city G decided to go to the cinema. The cinema administration placed them in a hall of size n \times m, which was specially selected so that all seats were filled by pupils. Each visitor was assigned a personal number.

The pupils took their seats as follows: they entered the hall in order of their numbers and completely filled the first row, then the second row, then the third row, and so on.

prb4752.gif

However, the class teacher thought that this seating arrangement negatively affected the pupils' behavior and rearranged them in another way: the pupils first occupied all the first seats of each row, then all the second seats of each row, and so on (see picture).

prb4752_1.gif

The administration decided to find out how many pupils did not change their seat after the rearrangement.

\InputFileThe first line contains numbers and (1 \le n, m \le 10^9).

\OutputFilePrint one number: the number of pupils whose seat did not change after the rearrangement.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading