Some error occured while loading page for you. Please try again.
Mary has an piece of paper that she wants to cut into pieces according to the following rules:
Given and , find and print the minimum number of cuts Mary must make to cut the paper into squares that are unit in size.
A single line of two space-separated integers denoting the respective values of and .
Print a long integer denoting the minimum number of cuts needed to cut the entire paper into squares.
Mary first cuts the piece of paper into a piece and a piece. She then cuts the piece into two pieces:
Because it took her two cuts to get pieces of size , we print as our answer.