#include <bits/stdc++.h>
struct Sqrt{
    long long *a, *b;
    int SQ;
    explicit Sqrt(int n){
        SQ = (int)sqrt(n) + 1;
        a = new long long[n]{};
        b = new long long[SQ]{};
    }
    ~Sqrt() = default;
    void update(int r, long long v) const {
        for(int j=0; j<r/SQ; ++j)
            b[j] += v;
        for(int i=(r/SQ)*SQ; i<r; ++i)
            a[i] += v;
    }
    void update(int l, int r, long long v) const {
        update(r, v);
        update(l, -v);
    }
    [[nodiscard]] long long get(int i) const{
        return b[i/SQ] + a[i];
    }
};
struct Query{
    int op, a, b;
    long long x, p;
};
int main() {
    std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr);
    int n, q;
    std::cin >> n >> q;
    Query b[n+q];
    for(int i=0; i<n; ++i)
        std::cin >> b[i].p >> b[i].a >> b[i].b, b[i].op = 1;
    std::vector<long long> numbers;
    std::map<long long, int> flatten;
    for(int j=n; j-n<q; ++j){
        std::cin >> b[j].op;
        if(b[j].op == 1)
            std::cin >> b[j].p >> b[j].a >> b[j].b;
        else {
            std::cin >> b[j].x;
            numbers.push_back(b[j].x);
        }
    }
    std::sort(numbers.begin(), numbers.end());
    numbers.erase(std::unique(numbers.begin(), numbers.end()), numbers.end());
    int m = numbers.size();
    for(int c=0; c<m; ++c)
        flatten[numbers[c]] = c;
    Sqrt st(m);
    for(int i=0; i<m; ++i)
        st.update(i,i+1,numbers[i]);
    for(int j=0; j<q+n; ++j) {
        if(b[j].op == 1){
            int l{}, r{m};
            while(l<=r){
                int k = (l+r)/2;
                if(st.get(k) < b[j].p)
                    l = k + 1;
                else
                    r = k - 1;
            }
            st.update(0, l, -b[j].b);
            st.update(l, m, b[j].a);
        }
        else{
            std::cout << st.get(flatten[b[j].x]) << '\n';
        }
    }
}
				I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnN0cnVjdCBTcXJ0ewogICAgbG9uZyBsb25nICphLCAqYjsKICAgIGludCBTUTsKICAgIGV4cGxpY2l0IFNxcnQoaW50IG4pewogICAgICAgIFNRID0gKGludClzcXJ0KG4pICsgMTsKICAgICAgICBhID0gbmV3IGxvbmcgbG9uZ1tuXXt9OwogICAgICAgIGIgPSBuZXcgbG9uZyBsb25nW1NRXXt9OwogICAgfQogICAgflNxcnQoKSA9IGRlZmF1bHQ7CiAgICB2b2lkIHVwZGF0ZShpbnQgciwgbG9uZyBsb25nIHYpIGNvbnN0IHsKICAgICAgICBmb3IoaW50IGo9MDsgajxyL1NROyArK2opCiAgICAgICAgICAgIGJbal0gKz0gdjsKICAgICAgICBmb3IoaW50IGk9KHIvU1EpKlNROyBpPHI7ICsraSkKICAgICAgICAgICAgYVtpXSArPSB2OwogICAgfQogICAgdm9pZCB1cGRhdGUoaW50IGwsIGludCByLCBsb25nIGxvbmcgdikgY29uc3QgewogICAgICAgIHVwZGF0ZShyLCB2KTsKICAgICAgICB1cGRhdGUobCwgLXYpOwogICAgfQogICAgW1tub2Rpc2NhcmRdXSBsb25nIGxvbmcgZ2V0KGludCBpKSBjb25zdHsKICAgICAgICByZXR1cm4gYltpL1NRXSArIGFbaV07CiAgICB9Cn07CnN0cnVjdCBRdWVyeXsKICAgIGludCBvcCwgYSwgYjsKICAgIGxvbmcgbG9uZyB4LCBwOwp9OwppbnQgbWFpbigpIHsKICAgIHN0ZDo6aW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7IHN0ZDo6Y2luLnRpZShudWxscHRyKTsKICAgIGludCBuLCBxOwogICAgc3RkOjpjaW4gPj4gbiA+PiBxOwogICAgUXVlcnkgYltuK3FdOwogICAgZm9yKGludCBpPTA7IGk8bjsgKytpKQogICAgICAgIHN0ZDo6Y2luID4+IGJbaV0ucCA+PiBiW2ldLmEgPj4gYltpXS5iLCBiW2ldLm9wID0gMTsKICAgIHN0ZDo6dmVjdG9yPGxvbmcgbG9uZz4gbnVtYmVyczsKICAgIHN0ZDo6bWFwPGxvbmcgbG9uZywgaW50PiBmbGF0dGVuOwogICAgZm9yKGludCBqPW47IGotbjxxOyArK2opewogICAgICAgIHN0ZDo6Y2luID4+IGJbal0ub3A7CiAgICAgICAgaWYoYltqXS5vcCA9PSAxKQogICAgICAgICAgICBzdGQ6OmNpbiA+PiBiW2pdLnAgPj4gYltqXS5hID4+IGJbal0uYjsKICAgICAgICBlbHNlIHsKICAgICAgICAgICAgc3RkOjpjaW4gPj4gYltqXS54OwogICAgICAgICAgICBudW1iZXJzLnB1c2hfYmFjayhiW2pdLngpOwogICAgICAgIH0KICAgIH0KICAgIHN0ZDo6c29ydChudW1iZXJzLmJlZ2luKCksIG51bWJlcnMuZW5kKCkpOwogICAgbnVtYmVycy5lcmFzZShzdGQ6OnVuaXF1ZShudW1iZXJzLmJlZ2luKCksIG51bWJlcnMuZW5kKCkpLCBudW1iZXJzLmVuZCgpKTsKICAgIGludCBtID0gbnVtYmVycy5zaXplKCk7CiAgICBmb3IoaW50IGM9MDsgYzxtOyArK2MpCiAgICAgICAgZmxhdHRlbltudW1iZXJzW2NdXSA9IGM7CiAgICBTcXJ0IHN0KG0pOwogICAgZm9yKGludCBpPTA7IGk8bTsgKytpKQogICAgICAgIHN0LnVwZGF0ZShpLGkrMSxudW1iZXJzW2ldKTsKICAgIGZvcihpbnQgaj0wOyBqPHErbjsgKytqKSB7CiAgICAgICAgaWYoYltqXS5vcCA9PSAxKXsKICAgICAgICAgICAgaW50IGx7fSwgcnttfTsKICAgICAgICAgICAgd2hpbGUobDw9cil7CiAgICAgICAgICAgICAgICBpbnQgayA9IChsK3IpLzI7CiAgICAgICAgICAgICAgICBpZihzdC5nZXQoaykgPCBiW2pdLnApCiAgICAgICAgICAgICAgICAgICAgbCA9IGsgKyAxOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHIgPSBrIC0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBzdC51cGRhdGUoMCwgbCwgLWJbal0uYik7CiAgICAgICAgICAgIHN0LnVwZGF0ZShsLCBtLCBiW2pdLmEpOwogICAgICAgIH0KICAgICAgICBlbHNlewogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgc3QuZ2V0KGZsYXR0ZW5bYltqXS54XSkgPDwgJ1xuJzsKICAgICAgICB9CiAgICB9Cn0=