#include "happy.h"
#include<bits/stdc++.h>
using namespace std;
std::vector <long long int> happy (int N, int Q, std::vector <int> u, std::vector <int> v, std::vector <int> h, std::vector <int> t, std::vector <int> l, std::vector <int> r) {
    cin>>N>>Q;
        for(int i=0; i<N-1; i++)
        {
            cin>>u[i]>>v[i]>>h[i];
        }
        for(int i=0; i<Q; i++)
        {
            cin>>t[i]>>l[i]>>r[i];
        }
    vector<int>ans;
    for(int i=0; i<Q; i++)
    {
        if(t[i]==1)
        {
            for(int j=u[l[i]]; j<=v[r[i]]; j++)
            {
                ans[j]+=h[j];
            }
        }
        cout<<ans[i];
    }
}


