class RangeSumQuery(object):



    def __init__(self, size):

        self.size = 1

        while self.size <= size:

            self.size *= 2

        self.data = [0 for _ in range(self.size*2-1)]



    def add(self, idx, value):

        k = idx + self.size - 1

        self.data[k] += value

        while k > 0:

            k = (k - 1) / 2

            self.data[k] += value



    def get_sum(self, start, end):

        def query(k, left, right):

            if right <= start or end <= left:

                return 0

            if start <= left and right <= end:

                return self.data[k]

            vl = query(k*2+1, left, (left+right)/2)

            vr = query(k*2+2, (left+right)/2, right)

            return vl + vr

        return query(0, 0, self.size)





def main():

    n, q = list(map(int, input().split()))

    rsq = RangeSumQuery(n)

    for _ in range(q):

        com, x, y = list(map(int, input().split()))

        if com == 0:

            rsq.add(x, y)

        else:

            print(rsq.get_sum(x, y+1))



if __name__ == "__main__":

    main()
class BIT(object):



    def __init__(self, size, init_data=None):

        self.size = size

        if init_data is None:

            init_data = [0] * (size + 1)

        self.data = init_data



    def sum(self, idx):

        ret = 0

        while idx > 0:            

            ret += self.data[idx]

            idx -= idx & -idx # idx = idx & (idx - 1)

        return ret



    def add(self, idx, value):

        while idx <= self.size:

            self.data[idx] += value

            idx += idx & -idx



if __name__ == "__main__":

    n, q = list(map(int, input().split()))

    bit = BIT(n)

    for _ in range(q):

        com, x, y = list(map(int, input().split()))

        if com == 0:

            bit.add(x, y)

        else:

            print((bit.sum(y)-bit.sum(x-1)))
class RangeSumQuery(object):
    def __init__(self, size):
        self.size = 1
        while self.size <= size:
            self.size *= 2
        self.data = [0 for _ in range(self.size * 2 - 1)]

    def add(self, idx, value):
        k = idx + self.size - 1
        self.data[k] += value
        while k > 0:
            k = (k - 1) / 2
            self.data[k] += value

    def get_sum(self, start, end):
        def query(k, left, right):
            if right <= start or end <= left:
                return 0
            if start <= left and right <= end:
                return self.data[k]
            vl = query(k * 2 + 1, left, (left + right) / 2)
            vr = query(k * 2 + 2, (left + right) / 2, right)
            return vl + vr

        return query(0, 0, self.size)


def main():
    n, q = list(map(int, input().split()))
    rsq = RangeSumQuery(n)
    for _ in range(q):
        com, x, y = list(map(int, input().split()))
        if com == 0:
            rsq.add(x, y)
        else:
            print(rsq.get_sum(x, y + 1))


if __name__ == "__main__":
    main()

class BIT(object):
    def __init__(self, size, init_data=None):
        self.size = size
        if init_data is None:
            init_data = [0] * (size + 1)
        self.data = init_data

    def sum(self, idx):
        ret = 0
        while idx > 0:
            ret += self.data[idx]
            idx -= idx & -idx  # idx = idx & (idx - 1)
        return ret

    def add(self, idx, value):
        while idx <= self.size:
            self.data[idx] += value
            idx += idx & -idx


if __name__ == "__main__":
    n, q = list(map(int, input().split()))
    bit = BIT(n)
    for _ in range(q):
        com, x, y = list(map(int, input().split()))
        if com == 0:
            bit.add(x, y)
        else:
            print((bit.sum(y) - bit.sum(x - 1)))

-class RangeSumQuery(object): -    def __init__(self, size): -        self.size = 1 -        while self.size <= size: -            self.size *= 2 -        self.data = [0 for _ in range(self.size * 2 - 1)] +class BIT(object): +    def __init__(self, size, init_data=None): +        self.size = size +        if init_data is None: +            init_data = [0] * (size + 1) +        self.data = init_data + +    def sum(self, idx): +        ret = 0 +        while idx > 0: +            ret += self.data[idx] +            idx -= idx & -idx  # idx = idx & (idx - 1) +        return ret -        k = idx + self.size - 1 -        self.data[k] += value -        while k > 0: -            k = (k - 1) / 2 -            self.data[k] += value - -    def get_sum(self, start, end): -        def query(k, left, right): -            if right <= start or end <= left: -                return 0 -            if start <= left and right <= end: -                return self.data[k] -            vl = query(k * 2 + 1, left, (left + right) / 2) -            vr = query(k * 2 + 2, (left + right) / 2, right) -            return vl + vr - -        return query(0, 0, self.size) +        while idx <= self.size: +            self.data[idx] += value +            idx += idx & -idx -def main(): +if __name__ == "__main__": -    rsq = RangeSumQuery(n) +    bit = BIT(n) -            rsq.add(x, y) +            bit.add(x, y) -            print(rsq.get_sum(x, y + 1)) - - -if __name__ == "__main__": -    main() +            print((bit.sum(y) - bit.sum(x - 1)))