k, g = map(int, input().split())
id = [map(int, input().split()) for i in range(g)]
l, r = list(zip(*id))
print(max(min(r) - max(l) + 1, 0)) k, g = map(int, input().split()) k map(int, input().split()) map int input().split() ().split () input split g map(int, input().split()) for i in range(g) for i in range(g) i range(g) range g for i in range(g) map(int, input().split()) map int input().split() ().split () input split id = [map(int, input().split()) for i in range(g)] id [map(int, input().split()) for i in range(g)] l, r = list(zip(*id)) l list(zip(*id)) list zip(*id) zip *id id r print(max(min(r) - max(l) + 1, 0)) print max(min(r) - max(l) + 1, 0) max min(r) - max(l) + 1 min(r) - max(l) min(r) min r max(l) max l 1 0 l, r = list(zip(*id)) list(zip(*id)) l k, g = map(int, input().split()) map(int, input().split()) k g = map(int, input().split()) map(int, input().split()) g id = [map(int, input().split()) for i in range(g)] [map(int, input().split()) for i in range(g)] id r = list(zip(*id)) list(zip(*id)) r
k, g = map(int, input().split())
id = [map(int, input().split()) for i in range(g)]
l, r = list(zip(*id))
print(max(min(r) - max(l) + 1, 0))
