class BinaryIndexTree
  attr_reader :bit, :size

  def initialize(size, init: 0)
    @bit = Array.new(size, init)
    @size = size
  end

  def sum(i)
    s = 0

    while i > 0
      s += bit[i]
      i -= i & -i
    end

    s
  end

  def add(i, x)
    while i < size
      bit[i] += x
      i += i & -i
    end
  end
end

N, Q = gets.split.map(&:to_i)
bit = BinaryIndexTree.new(N + 1)

Q.times do
  com, x, y = gets.split.map(&:to_i)

  if com == 0
    bit.add(x, y)
  else
    puts bit.sum(y) - bit.sum(x - 1)
  end
end

