# Original solution
class TemplateTree:
  def __init__(self, iterable):
    self.iter_size = self.get_size(iterable)
    self.size = self.iter_size * 2 - 1
    self.value = [None] * self.size
    for i, v in enumerate(iterable):
      self.value[self.iter_size + i - 1] = v
    self.set_value(0)
    self.range = [None] * self.size
    self.set_range(0, 0, self.iter_size - 1)
  
  def get_size(self, iterable):
    ret = 1
    x = len(iterable)
    while ret < x:
      ret *= 2
    return ret
  
  def set_range(self, x, left, right):
    self.range[x] = (left, right)
    if left != right:
      self.set_range(x * 2 + 1, left, (right + left) // 2)
      self.set_range(x * 2 + 2, (right + left) // 2 + 1, right)

  def set_value(self, x):
    if x >= self.iter_size - 1:return self.value[x]
    a = self.set_value(x * 2 + 1)
    b = self.set_value(x * 2 + 2)
    if a == None and b == None:
      self.value[x] = None
    elif a == None:
      self.value[x] = b
    elif b == None:
      self.value[x] = a
    else:
      self.value[x] = a + b
    return self.value[x]

  def update(self, i, x):
    target = self.iter_size + i - 1
    while target >= 0:
      self.value[target] += x
      target = (target - 1) // 2

  def query(self, x, left, right):
    x_left, x_right = self.range[x]
    if right < x_left or x_right < left:
      #print("A")
      return 0
    if x_left < left and right < x_right:
      #print("B")
      return self.query(x * 2 + 1, left, right) + self.query(x * 2 + 2, left, right)
    if x_left < left and x_right <= right:
      #print("C")
      return self.query(x * 2 + 1, left, right) + self.query(x * 2 + 2, left, right)
    if left <= x_left and right < x_right:
      #print("D")
      return self.query(x * 2 + 1, left, right) + self.query(x * 2 + 2, left, right)
    if left <= x_left and x_right <= right:
      #print("E")
      return self.value[x]

  def print_tree(self):
    print((self.value))
    print((self.range))

n, q = list(map(int, input().split()))
tree = TemplateTree([0] * n)

for _ in range(q):
  c, x, y = list(map(int, input().split()))
  if c == 0:
    tree.update(x - 1, y)
  else:
    print((tree.query(0, x - 1, y - 1)))




# Optimized solution
class TemplateTree:
  def __init__(self, iterable):
    self.iter_size = self.get_size(iterable)
    self.size = self.iter_size * 2 - 1
    self.value = [None] * self.size
    for i, v in enumerate(iterable):
      self.value[self.iter_size + i - 1] = v
    self.set_value(0)
    self.range = [None] * self.size
    self.set_range(0, 0, self.iter_size - 1)
  
  def get_size(self, iterable):
    ret = 1
    x = len(iterable)
    while ret < x:
      ret *= 2
    return ret
  
  def set_range(self, x, left, right):
    self.range[x] = (left, right)
    if left != right:
      self.set_range(x * 2 + 1, left, (right + left) // 2)
      self.set_range(x * 2 + 2, (right + left) // 2 + 1, right)

  def set_value(self, x):
    if x >= self.iter_size - 1:return self.value[x]
    a = self.set_value(x * 2 + 1)
    b = self.set_value(x * 2 + 2)
    if a == None and b == None:
      self.value[x] = None
    elif a == None:
      self.value[x] = b
    elif b == None:
      self.value[x] = a
    else:
      self.value[x] = a + b
    return self.value[x]

  def update(self, i, x):
    target = self.iter_size + i - 1
    while target >= 0:
      self.value[target] += x
      target = (target - 1) // 2

  def query(self, x, left, right):
    x_left, x_right = self.range[x]
    if right < x_left or x_right < left:
      return 0
    if left <= x_left and x_right <= right:
      return self.value[x]

    return self.query(x * 2 + 1, left, right) + self.query(x * 2 + 2, left, right)

  def print_tree(self):
    print((self.value))
    print((self.range))

n, q = list(map(int, input().split()))
tree = TemplateTree([0] * n)

for _ in range(q):
  c, x, y = list(map(int, input().split()))
  if c == 0:
    tree.update(x - 1, y)
  else:
    print((tree.query(0, x - 1, y - 1)))