~/algor $ cat contests/round-6/A
A. Breaking a chocolate bar
Problem A
ICPC rules
1000 ms
64 MB
A chocolate bar of size consists of squares. One break splits any single piece into two along a straight line between the squares; you cannot stack several pieces and break them at once. What is the smallest number of breaks needed to split the bar completely into squares?
Input
One line contains two positive integers: and .
Output
One integer — the smallest number of breaks.
Note
Examples
Input #1
4 3
Output #1
11
Input #2
1 1
Output #2
0