Time limit
1s
Memory limit
128 MB
Taesu received a special cake for his birthday. From above, the cake looks like a large square with a smaller square hole removed from its center.
The large square and the hole both have center (0, 0), and all of their sides are parallel to the x-axis or the y-axis. Half of the side length of the large square is LC, and half of the side length of the hole is LH.
The cake will be cut H times horizontally and V times vertically. The i-th horizontal cut is made along the entire line y = h_i, parallel to the x-axis. The i-th vertical cut is made along the entire line x = v_i, parallel to the y-axis. If a cutting line passes through the hole, only the parts that actually meet the cake are cut.
Find the number of cake pieces after all cuts are made.
The first line contains LC and LH.
The second line contains H. The third line contains H integers h_i separated by spaces.
The fourth line contains V. The fifth line contains V integers v_i separated by spaces.
If H is 0, the third line is empty. If V is 0, the fifth line is empty.
Print the number of cake pieces on the first line.