array=[]
a=[]
while (true)
  n,r = gets.chomp.split.map(&:to_i)
  if (n==0 && r== 0)
    return 0
  end
  for i in 0..n-1
    array[n-1-i]=i+1
  end
  
  for j in 0..r-1
    p,c = gets.chomp.split.map(&:to_i)
    
    for j in 0..p-2
      a[j]=array[j]
    end
    for j in 0..c-1
      array[j]=array[p+j-2]
    end
    for j in 0..p-2
      array[c+i]=a[j]
    end
  end
  p array[0]
end

