ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

1760. Infernal Work

Time limit: 2.0 second
Memory limit: 64 MB
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 terrible torment.


The only input line contains integers a, b, n (1 ≤ a, bn ≤ 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)