eolymp
bolt
Try our new interface for solving problems
Problems

DVD and slut

DVD and slut

Peter can not accustom themselves to order. He always throws his belongings, and then for a long time can not find the desired object. And, most importantly, in my room from the often satisfied with such a mess, and that he then can not find a free place to work. One day before school Pete urgently needed to find a CD with their favorite cartoons, which he promised to give his friend. But of course DVD from Petit also in a mess, boxes are reversed, the inscriptions on the boxes do not correspond to their content. Therefore, to find the correct drive, Peter poured them all out of the box on the table and started frantically going over in search of desired. The required disk Petya yet found, and all the rest were left lying on the table. Very sad, that before this Peter poured on the table is a heap of coins, which, as we know, too, are small discs Earlier Peter had breakfast and left the dirty dishes on the table. As a result, on a table at Petit remained nightmarish mess! Marinka - Petit's younger sister - has decided to somehow restore order at the table, but the wheels and other things she did not touch, but just covered rectangular sheets of paper those portions of the table where lay the abandoned Petya items. Sheets of paper she placed so that their sides were parallel to the edges of the table, with Marina tried to use as soon as smaller sheets of paper. Sheets of paper can not overlap. Each disc can be served by only one sheet of paper. After the work done Marinka was interesting to know what area is left uncovered paper. Help Marinka solve this problem! \textbf{Input } In the first line of the input file are given two integers: \textbf{X}, \textbf{Y} - the size of the table horizontally and vertically (\textbf{0} < \textbf{X}, \textbf{Y} ≤ \textbf{1000}). On the second line of the file is a single integer \textbf{N} - number of discs on the table (\textbf{0} ≤ \textbf{N} ≤ 100). Then follow N lines, each of which contains \textbf{x}\[\textbf{i}\], \textbf{y}\[\textbf{i}\], \textbf{r}\[\textbf{i}\] - the whole center coordinates and radius of the round objects. It is guaranteed that the round objects are entirely on the table and not hang over the edge of the table. \textbf{Output} Display area of the table, free from rectangular sheets of paper that cover subjects.
Time limit 1 second
Memory limit 64 MiB
Input example #1
10 8
2
4 4 2
6 4 1
Output example #1
60
Source Отборочный тур Всероссийской командной олимпиады школьников 2009/2010 учебный год