#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;
vector<bool> used(100010,false);
map<ll,ll> id;
vec depth(100010);
vp edge(0), euler(200020,P(INF,0));
mat parent(18,vec(100010));
matP G(100010,vp(0));//to,index(of edge);
matP c_euler(100009,vp(0)), cnum_euler(100009,vp(0));

void task(P e, ll i, ll k, ll num) {
    euler[k].fi = i;
    euler[k].se = euler[max(0LL, k - 1)].se + e.se*num;
    c_euler[e.fi].emplace_back(i, e.se*num);
    cnum_euler[e.fi].emplace_back(i, num);
    if(c_euler[e.fi].size() > 1) {
        ll size = c_euler[e.fi].size();
        --size;
        c_euler[e.fi][size].se += c_euler[e.fi][size - 1].se;
        cnum_euler[e.fi][size].se += cnum_euler[e.fi][size - 1].se;
    }
    //cout<<i<<' '<<k<<endl;
}
void dfs(ll v, ll d, ll &i, ll &k){
    used[v] = true;
    depth[v] = d;
    id[v] = i++;
    for(P to : G[v]){
        if(used[to.fi]){
            parent[0][v] = to.fi;
        }else{
            P e = edge[to.se];
            //if(to.se == 2) cout<<i<<' '<<k<<endl;
            task(e, i, k++, 1);
            dfs(to.fi, d+1, i, k);
            task(e, i, k++, -1);
        }
    }
}

ll lcm(ll u, ll v){
    if(depth[u] < depth[v]) swap(u,v);
    ll U = u, V = v;
    rep(i,18){
        if(((depth[u] - depth[v])>>i)&1){
            U = parent[i][U];
        }
    }
    if(U == V) return U;
    for(int i = 17; i >= 0; --i){
        if(parent[i][U] != parent[i][V]){
            U = parent[i][U];
            V = parent[i][V];
        }
    }
    return parent[0][U];
}

void find_index(ll v, ll color, ll &index1, ll &index2, ll &index3){
    P p = {id[v],INF};
    index1 = lower_bound(euler.begin(), euler.end(), p) - euler.begin();
    index2 = lower_bound(c_euler[color].begin(), c_euler[color].end(), p) - c_euler[color].begin();
    index3 = lower_bound(cnum_euler[color].begin(), cnum_euler[color].end(), p) - cnum_euler[color].begin();
}

void calc(ll &out, ll color, ll cons, ll index1, ll index2, ll index3, ll num){
    out += (index1 == 0) ? 0 : euler[index1 - 1].se * num;
    out -= (index2 == 0) ? 0 : c_euler[color][index2 - 1].se * num;
    out += (index3 == 0) ? 0 : cons * cnum_euler[color][index3 - 1].se * num;
}
int main() {
    cin>>N>>Q;
    rep(i,N-1){
        cin>>A>>B;
        --A;
        --B;
        G[A].emplace_back(B,i);
        G[B].emplace_back(A,i);
        cin>>A>>B;
        --A;
        edge.emplace_back(A,B);
    }
    ll I=0, k=0;
    dfs(0LL, 0LL, I, k);
    parent[0][0] = -1;
    reps(i,1,18){
        rep(j,N){
            ll p = parent[i-1][j];
            if(p < 0) parent[i][j] = -1;
            else parent[i][j] = parent[i-1][p];
        }
    }

    /*rep(i,N*2-2) cout<<euler[i].fi<<' '<<euler[i].se<<endl;
    cout<<endl;
    rep(i,N-1) {
        cout<<i<<endl;
        for(P p : cnum_euler[i]){
            cout<<p.fi<<' '<<p.se<<endl;
        }
    }
    cout<<endl;*/

    ll color, cons, u, v, index1, index2, index3;
    rep(nouse,Q){
        cin>>color>>cons>>u>>v;
        --color; --u; --v;
        ll LCM = lcm(u, v);
        ll out = 0;
        find_index(u,color,index1, index2, index3);
        //cout<<index1<<' '<<index2<<' '<<index3<<endl;
        calc(out, color, cons, index1, index2, index3,1);
        find_index(v,color,index1, index2, index3);
        calc(out, color, cons, index1, index2, index3,1);
        find_index(LCM,color,index1, index2, index3);
        calc(out, color, cons, index1, index2, index3,-2);
        cout<<out<<endl;
    }
}


Measured memory_bytes: 55788