N, Q = gets.split.map &:to_i
SqN = (N**0.5).to_i
K = N.fdiv(SqN).ceil
a = [0] * SqN * K
sq = [0] * SqN

$<.each{|s|
  com, x, y = s.split.map &:to_i
  x -= 1
  if com == 0
    # add
    a[x] += y
    sq[x / K] += y
  else
    # getSum
    sum = 0
    K.step(SqN * K, K){|r|
      l = r - K
      next if y <= l || r <= x
      if x <= l && r <= y
        sum += sq[r / K - 1]
      else
        # p [a,[x, l].max...[y, r].min]
        sum += a[[x, l].max...[y, r].min].sum
      end
    }
    p sum
  end
  # p [a,sq]
}

