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