n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(m)]
l,r = [list(i) for i in zip(*a)]
print(max(0,min(r)-max(l)+1)) 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 a = [list(map(int,input().split())) for i in range(m)] a [list(map(int,input().split())) for i in range(m)] list(i) for i in zip(*a) for i in zip(*a) i zip(*a) zip *a a for i in zip(*a) list(i) list i l,r = [list(i) for i in zip(*a)] l [list(i) for i in zip(*a)] r print(max(0,min(r)-max(l)+1)) print max(0,min(r)-max(l)+1) max 0 min(r)-max(l)+1 min(r)-max(l) min(r) min r max(l) max l 1 n,m = map(int,input().split()) map(int,input().split()) n r = [list(i) for i in zip(*a)] [list(i) for i in zip(*a)] r m = map(int,input().split()) map(int,input().split()) m a = [list(map(int,input().split())) for i in range(m)] [list(map(int,input().split())) for i in range(m)] a l,r = [list(i) for i in zip(*a)] [list(i) for i in zip(*a)] l
n,m = map(int,input().split())
a = [list(map(int,input().split())) for i in range(m)]
l,r = [list(i) for i in zip(*a)]
print(max(0,min(r)-max(l)+1))