(RankList for this Question)
Imagine you have a large rectangular piece of paper with dimensions a×b, and you're embarking on a creative project. Your mission is to transform this paper into squares, but there's a twist: you can only use a pair of scissors to make cuts.
The challenge is to achieve this transformation using as few cuts as possible, ensuring that all sides of the resulting pieces remain whole numbers. Can you figure out the minimum number of cuts required to turn this paper into squares, thus unlocking the full potential of your artistic endeavor?
The only input line has two integers a and b
Print the minimum number of moves.
This testcase is self explanatory
Log In to solve the Question