Two shift logs are recorded. Within one log the shifts are given sorted by start and never overlap each other; each shift is a half-open interval [start, end). Report the total length of time that is covered by a shift in the first log AND a shift in the second log simultaneously.
Input format
Line 1: two integers n and m.
Next n lines: two integers start end for log A (sorted, non-overlapping).
Next m lines: two integers start end for log B (sorted, non-overlapping).
Output format
A single integer: the total length of the intersection of the two logs.
Constraints
- 1 ≤ n, m ≤ 100000
- 0 ≤ start < end ≤ 1000000
- Each log is sorted by start and internally non-overlapping.