Railwaymen Vassily and Pyotr died and were sent to Hell. Their first punishment
was to perform a complete inspection of the Moscow–Vladivostok railroad.
They spent many weeks walking along the railroad together, one of them along the
left rail and the other along the right rail, writing the long serial numbers
of ties to their thick notebooks. As soon as they finished that infernal task,
they immediately got a new task, which was even more meaningless. Now they had
to count the number of pairs of ties that were written in Vassily's notebook on
the same page and in Pyotr's notebook on different pages.
The friends came to you in a dream and asked you to save them from that
The only input line contains integers a, b, n
(1 ≤ a, b ≤ n ≤ 25 000 000).
One page in Vassily's notebook comprises a numbers of ties,
and one page in Pyotr's notebook comprises b numbers of ties.
They have written numbers of n ties. All these numbers are
different and are written in their notebooks in the same order.
Output one number, which is the answer to the problem.
3 4 10
2 4 10
Let the ties in the first sample be numbered by the letters from A to J.
Then the following four pairs satisfy the condition:
(D, E), (D, F), (G, I), (H, I).
Problem Author: Alexander Ipatov
Problem Source: XI USU Open Personal Contest (March 13, 2010)