Two teammates each publish a roster of busy windows. Within one roster the windows are given sorted by start and never overlap each other. A window from the first roster and a window from the second overlap if they share a stretch of positive length (touching at a single endpoint does not count). Count the number of pairs (one window from each roster) that overlap.
Input format
Line 1: two integers n and m.
Next n lines: two integers start end for roster A (sorted, non-overlapping).
Next m lines: two integers start end for roster B (sorted, non-overlapping).
Output format
A single integer: the number of overlapping window pairs.
Constraints
- 1 ≤ n, m ≤ 100000
- 0 ≤ start < end ≤ 1000000
- Each roster is sorted by start and internally non-overlapping.