# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


class RSQ(object):
    INT_MAX = 2**31 - 1

    def __init__(self, nn, init_val=0):
        self.val = [init_val] * (nn+1)
        self.n = 1
        while self.n < nn:
            self.n *= 2
        self.dat = [init_val] * ((2 * self.n)-1)

    def update(self, k, a):
        # A[k]???a?????´??°?????????????????°???????????¨?????´??°
        self.val[k] = a
        k += (self.n - 1)
        self.dat[k] = a

        while k > 0:
            k = (k - 1) // 2        #  ??????index??????
            self.dat[k] = self.dat[k * 2 + 1] + self.dat[k * 2 + 2]

    def add(self, k, a):
        self.val[k] += a
        self.update(k, self.val[k])

    def query(self, a, b, k, l, r):
        # [a, b)???????°????????±??????? (0????????§b???????????????)
        # ??????????????¨?????????query(a, b, 0, 0, n)?????¢??§??????????????????k, l, r???????????????????????´??°?????????
        if r <= a or b <= l:        #  ?????????????????§??¨??????????????????
            return RSQ.INT_MAX
        if a ==l and r == b:
            return self.dat[k]           #  ???????????°???????????????????????§????????°????????¨??????????????????????°?????????????????????????
        else:
            mid = (l+r) // 2
            if b <= mid:
                return self.query(a, b, k*2+1, l, (l+r)//2) #  ????????°????????????????°????
            elif a >= mid:
                return self.query(a, b, k*2+2, (l+r)//2, r) #  ????????°????????????????°????
            else:
                vl = self.query(a, mid, k*2+1, l, mid)
                vr = self.query(mid, b, k*2+2, mid, r)
                return vl + vr


    def find(self, s, t):
        return self.query(s, t+1, 0, 0, self.n)


def main(args):
    n, q = map(int, input().split(' '))

    rq = RSQ(n)
    for _ in range(q):
        com, x, y = map(int, input().split(' '))
        if com == 0:
            rq.add(x, y)
        elif com == 1:
            res = rq.find(x, y)
            print(res)


if __name__ == '__main__':
    main(sys.argv[1:])

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


class BIT(object):
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        #  ?????????????????????????????¢?????????????¶?????????????
        while i > 0:
            s += self.bit[i]
            i &= (i - 1)
#            i -= (i & -i)

        return s

    def add(self, i, x):
        while i <= self.n:
            self.bit[i] += x
            i += (i & -i)

    def find(self, s, t):
        t_sum = self.sum(t)
        s_sum = self.sum(s - 1)
        return t_sum - s_sum


def main(args):
    n, q = map(int, input().split(' '))

    rq = BIT(n+1)
    for _ in range(q):
        com, x, y = map(int, input().split(' '))
        if com == 0:
            rq.add(x, y)
        elif com == 1:
            res = rq.find(x, y)
            print(res)


if __name__ == '__main__':
    main(sys.argv[1:])