class SegmentTree
  
  def initialize
    @N=2**17
    @Z=0
    @seg=Array.new(2*@N-1){@Z}
  end
  
  def add(i, x)
    i+=@N-1
    @seg[i]+=x
    while i.nonzero?
      i=(i-1)/2
      @seg[i]=@seg[2*i+1]+@seg[2*i+2]
    end
  end
  
  def sum(a, b, i=0, l=0, r=@N)
    if b<=l or r<=a
      @Z
    elsif a<=l and r<=b
      @seg[i]
    else
      m=(r+l)/2
      vl=sum(a, b, 2*i+1, l, m)
      vr=sum(a, b, 2*i+2, m, r)
      vl+vr
    end
  end
  
end

st=SegmentTree.new
n, q=gets.split.map(&:to_i)
q.times do
  c, a, b=gets.split.map(&:to_i)
  case c
  when 0
    st.add(a, b)
  when 1
    puts st.sum(a, b+1)
  end
end