#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
//13:00-16:00
typedef pair<ll,ll> P;
const ll MAX_N=1e5,MAX_Q=1e5,MAX_LOG_N=20;
ll N,Q;
struct edge{
    ll to,col,cst,id;
};
vector<edge> G[MAX_N];
ll dep[MAX_N],par[MAX_N][MAX_LOG_N],pare[MAX_N];
void calpar(ll v,ll p){
    par[v][0]=p;
    FOR(i,1,MAX_LOG_N){
        if(par[v][i-1]!=-1){
            par[v][i]=par[par[v][i-1]][i-1];
        }else{
            par[v][i]=-1;
        }
    }
    for(auto e:G[v]){
        if(e.to!=p){
            calpar(e.to,v);
        }
    }
}
void caldep(ll v,ll d){
    dep[v]=d;
    for(auto e:G[v]){
        if(e.to!=par[v][0]){
            caldep(e.to,d+1);
        }
    }
}
ll lca(ll u,ll v){
    if(dep[u]>dep[v]){
        swap(u,v);
    }
    for(ll i=MAX_LOG_N-1;i>=0;i--){
        if(dep[u]<=dep[v]-(1<<i)){
            v=par[v][i];
        }
    }
    if(u==v){
        return u;
    }
    for(ll i=MAX_LOG_N-1;i>=0;i--){
        if(par[u][i]!=par[v][i]){
            u=par[u][i];
            v=par[v][i];
        }
    }
    return par[u][0];
}
vector<P> etour[MAX_N][2];
vector<ll> etourpsm[MAX_N][2];
ll etourt,pareetourid[MAX_N];
void caletour(ll v){
    for(auto e:G[v]){
        if(e.to!=par[v][0]){
            etour[e.col][0].push_back(P(e.cst,etourt));
            etour[e.col][1].push_back(P(1,etourt));
            pareetourid[e.to]=etourt;
            etourt++;
            caletour(e.to);
        }
    }
    if(pare[v]!=-1){
        edge e=G[v][pare[v]];
        etour[e.col][0].push_back(P(-e.cst,etourt));
        etour[e.col][1].push_back(P(-1,etourt));
        etourt++;
    }
}
ll dst[MAX_N];
void caldst(ll v,ll d){
    dst[v]=d;
    for(auto e:G[v]){
        if(e.to!=par[v][0]){
            caldst(e.to,d+e.cst);
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>Q;
    REP(i,N-1){
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        a--;
        b--;
        G[a].push_back((edge){b,c,d,i});
        G[b].push_back((edge){a,c,d,i});
    }
    calpar(0,-1);
    caldep(0,0);
    //calpare
    REP(v,N){
        pare[v]=-1;
        REP(i,G[v].size()){
            if(G[v][i].to==par[v][0]){
                pare[v]=i;
            }
        }
    }
    caldst(0,0);
    etourt=0;
    pareetourid[0]=-1;
    caletour(0);
    REP(i,N)REP(j,2){
        etourpsm[i][j].push_back(0);
        for(auto k:etour[i][j]){
            etourpsm[i][j].push_back(etourpsm[i][j].back()+k.first);
        }
    }
//    cout<<"debug"<<endl;
    REP(q,Q){
        ll x,y,u,v;
        cin>>x>>y>>u>>v;
        u--;
        v--;
        ll l=lca(u,v);
        auto calspdst=[&](ll a){
            ll l,r;
            l=-1;
            r=etour[x][0].size();
            while(r-l>1){
                ll m=(l+r)/2;
                if(etour[x][0][m].second<=pareetourid[a]){
                    l=m;
                }else{
                    r=m;
                }
            }
            ll ret=dst[a];
            if(l>=0){
                ret+=etourpsm[x][1][l+1]*y-etourpsm[x][0][l+1];
            }
            return ret;
        };
        cout<<calspdst(u)+calspdst(v)-2*calspdst(l)<<endl;
    }
}


Measured memory_bytes: 123132