n,m = map(int, input().split())
left = set()
right = set()
for i in range(m):
  l,r = map(int, input().split())
  left.add(l)
  right.add(r)
mini = max(left)
maxi = min(right)
print(len(range(mini,maxi+1))) n,m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m left = set() left set() set right = set() right set() set for i in range(m):
  l,r = map(int, input().split())
  left.add(l)
  right.add(r) i range(m) range m l,r = map(int, input().split()) l map(int, input().split()) map int input().split() ().split () input split r left.add(l) left.add left add l right.add(r) right.add right add r mini = max(left) mini max(left) max left maxi = min(right) maxi min(right) min right print(len(range(mini,maxi+1))) print len(range(mini,maxi+1)) len range(mini,maxi+1) range mini maxi+1 maxi 1 left = set() set() left mini = max(left) max(left) mini r = map(int, input().split()) map(int, input().split()) r right = set() set() right m = map(int, input().split()) map(int, input().split()) m n,m = map(int, input().split()) map(int, input().split()) n l,r = map(int, input().split()) map(int, input().split()) l maxi = min(right) min(right) maxi
n,m = map(int, input().split())
left = set()
right = set()
for i in range(m):
  l,r = map(int, input().split())
  left.add(l)
  right.add(r)
mini = max(left)
maxi = min(right)
print(len(range(mini,maxi+1)))