N, M = [int(x) for x in input().split()]
L = list()
R = list()
for i in range(M):
  l, r = [float(x) for x in input().split()]
  L.append(l)
  R.append(r)
Lmax = max(L)
Rmin = min(R)
if(Rmin-Lmax)<0:
  print(0)
else:
  print(int(Rmin-Lmax+1)) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N, M = [int(x) for x in input().split()] N [int(x) for x in input().split()] M L = list() L list() list R = list() R list() list for i in range(M):
  l, r = [float(x) for x in input().split()]
  L.append(l)
  R.append(r) i range(M) range M float(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() float(x) float x l, r = [float(x) for x in input().split()] l [float(x) for x in input().split()] r L.append(l) L.append L append l R.append(r) R.append R append r Lmax = max(L) Lmax max(L) max L Rmin = min(R) Rmin min(R) min R if(Rmin-Lmax)<0:
  print(0)
else:
  print(int(Rmin-Lmax+1)) (Rmin-Lmax)<0 Rmin-Lmax Rmin Lmax 0 print(0) print 0 print(int(Rmin-Lmax+1)) print int(Rmin-Lmax+1) int Rmin-Lmax+1 Rmin-Lmax Rmin Lmax 1 N, M = [int(x) for x in input().split()] [int(x) for x in input().split()] N M = [int(x) for x in input().split()] [int(x) for x in input().split()] M L = list() list() L Lmax = max(L) max(L) Lmax Rmin = min(R) min(R) Rmin l, r = [float(x) for x in input().split()] [float(x) for x in input().split()] l R = list() list() R r = [float(x) for x in input().split()] [float(x) for x in input().split()] r
N, M = [int(x) for x in input().split()]
L = list()
R = list()
for i in range(M):
  l, r = [float(x) for x in input().split()]
  L.append(l)
  R.append(r)
Lmax = max(L)
Rmin = min(R)
if(Rmin-Lmax)<0:
  print(0)
else:
  print(int(Rmin-Lmax+1))