class FenwickTree
  attr_accessor :n, :array, :bit

  def initialize(n, array)
    @n = n
    @bit = Array.new(@n+1, 0)
    @array = array.dup
    for i in 0..n
      add(i,@array[i])
    end
  end

  def sum(idx)
    ans = 0
    idx += 1
    while not idx.zero?
      ans += @bit[idx]
      least = idx&-idx
      idx -= least
    end
    ans
  end

  def range(left, right)
    if left > right
      0
    else
      sum(right)-sum(left-1)
    end
  end

  def add(idx, x)
    idx += 1
    while idx <= @n
      @bit[idx] += x
      least = idx&-idx
      idx += least
    end
  end
end

lines = $stdin.read
array = lines.split("\n")
n,q = array[0].split(" ").map(&:to_i)
ft = FenwickTree.new(n, Array.new(n,0))

array[1..1+q].each do |s|
  com,x,y = s.split(" ").map(&:to_i)
  if com == 0
    ft.add(x,y)
  else
    puts ft.range(x,y)
  end
end
