while line=gets
  n,r=line.split(/ /).map{|i| i.to_i}
  break if n==0
  a=Array.new(n)
  for i in 0..n-1
    a[i]=n-i
  end
  for i in 0..r-1
    p,c=gets.chomp.split(/ /).map{|i| i.to_i}
    tmp1=a[0..p-2]
    tmp2=a[p-1..p-2+c]
    a[0..c-1]=tmp2
    a[c..p-2+c]=tmp1
  end
  print a[0],"\n"
end

    