eolymp
bolt
Try our new interface for solving problems
Problems

Construction

Construction

Once a representative of the Accounts Chamber of the Russian Federation Igor D. Traffic visited a military unit, taking into account № 192.168.0.9 and watched the construction of its soldiers. He noticed that when the soldiers lined up in rows by \textbf{N} columns, ranks in the last \textbf{N-1} was the soldier, and when the same number of soldiers lined up in rows of \textbf{M} columns, the last ranks of \textbf{M-1} was the soldier. All other ranks were full. Later he took on this data set the number of soldiers in the unit. He understood that uniquely identify this number can not, therefore decided to limit myself by finding the minimum possible number of soldiers. This role is to delegate to his deputy, ie You. From what you and congratulations. \InputFile The input file are given two positive integers \textbf{N} and \textbf{M} are separated by a space (\textbf{2} ≤ \textbf{N}, \textbf{M} ≤ \textbf{150000}). \OutputFile The output file output a single number: the required minimum number of soldiers in the unit. It is guaranteed that it fits in the range \textbf{Longint}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3 4
Output example #1
11