#include <iostream>
#include <vector>
using namespace std;

struct SegmentTree {
    vector <int> t;
    int half;

    SegmentTree (vector <int> & a, int n) {
        half = 1;
        while (half < n) half *= 2;
        t = vector <int> (half * 2);
        for (int i = 0; i < n; i++)
            t[i + half] = a[i];
        for (int i = half - 1; i >= 1; i--)
            t[i] = t[i * 2] + t[i * 2 + 1];
    }

    void add (int pos, int val) {
        for (pos += half; pos > 0;
             pos /= 2)
            t[pos] += val;
    }

    int sum (int lo, int hi) {
        int res = 0;
        for (lo += half, hi += half;
             lo < hi;
             lo /= 2, hi /= 2) {
            if (lo & 1)
                res += t[lo++];
            if (hi & 1)
                res += t[--hi];
        }
        return res;
    }
};

int main () {
    int n, m;
    cin >> n >> m;
    vector <int> a (n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    SegmentTree z (a, n);
    for (int j = 0; j < m; j++) {
        string type;
        cin >> type;
        if (type == "add") {
            int i, x;
            cin >> i >> x;
            z.add (i - 1, x);
        }
        if (type == "sum") {
            int lo, hi;
            cin >> lo >> hi;
            cout << z.sum (lo - 1, hi) << endl;
        }
    }
    return 0;
}
