# Two dimensional arrays

# Cinema

Once the pupils of the **B**-th school of city **G** decided to go to cinema. Cinema Administration has placed them in the hall of size **n** × **m**, which has been specially selected so that all the seats were occupied by pupils. Each cinema visitor was given a number.

Pupils took their places in the following way: they entered the hall in the order of their numbers, and fully occupied initially the first row, then second row, then third row, etc.

However the class teacher decided that such seating is bad for the behavior of pupils and replaced them in another way: the pupils first occupied all the first places of each row, then all the second places in each row, etc. (see picture).

The administration has decided to find out how many pupils do not change their place after replacement.

#### Input

First line contains numbers **n** and **m** (**1** ≤ **n**, **m** ≤ **1000**).

#### Output

Print the number of pupils whose seat was not changed after replacement.

3 3

3

3 4

2