Types: N: int, M: int, segments: List[Tuple[int, int, int, int]]
Ranges: 1 ≤ N, M ≤ 10^3, 0 ≤ x1, y1, x2, y2 ≤ 10^3
Addtl Info: The expressions will always have the correct syntax. No numbers other than 0 will have a leading 0.