#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
vector<pll> v[100010];
vector<pll> vc[100010];
vector<ll> w;
ll sen[100010];
ll n,q,a[100010],b[100010],c[100010],d[100010];
bool used[100010];
ll cnt;
void dfs(ll now){
    if(sen[now]==-1)sen[now]=cnt;
    //cout<<now<<" ";
    rep(i,0,v[now].size()){
        pll p=v[now][i];
        ll ne=p.first,num=p.second;
        if(used[ne])continue;
        used[ne]=true;
        vc[c[num]].push_back({cnt,d[num]});
        w.push_back(d[num]);
        cnt++;
        dfs(ne);
        vc[c[num]].push_back({cnt,-d[num]});
        w.push_back(-d[num]);
        cnt++;
    }
}
ll ne;

vector<ll> vn[100010];
ll par[60][100010];
ll dep[100010];
void lcadfs(ll vv,ll p,ll d){
    par[0][vv]=p;
    dep[vv]=d;
    for(ll i=0;i<vn[vv].size();i++){
        if(vn[vv][i]!=p)lcadfs(vn[vv][i],vv,d+1);
    }
}
void lcainit(ll n){
    lcadfs(ne,-1,0);
    for(ll i=0;i<59;i++){
        for(ll j=1;j<=n;j++){
            if(par[i][j]<0)par[i+1][j]=-1;
            else par[i+1][j]=par[i][par[i][j]];
        }
    }
}
ll lca(ll u,ll v){
    if(dep[u]>dep[v])swap(u,v);
    for(ll i=0;i<60;i++){
        if((dep[v]-dep[u])>>i&1)v=par[i][v];
    }
    if(u==v)return u;
    for(ll i=59;i>=0;i--){
        if(par[i][u]!=par[i][v]){
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>q;
    rep(i,0,n-1){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        v[a[i]].push_back({b[i],i});
        v[b[i]].push_back({a[i],i});
        vn[a[i]].push_back(b[i]);
        vn[b[i]].push_back(a[i]);
    }
    fill(sen,sen+n+1,-1);
    fill(used,used+n+1,false);
    cnt=0;
    used[1]=true;
    dfs(1);
    vector<ll> num[n];
    vector<ll> sum[n];
    rep(i,1,n){
        num[i].push_back(0);
        sum[i].push_back(0);
        rep(j,0,vc[i].size()){
            pll p=vc[i][j];
            if(p.second>0){
                num[i].push_back(num[i].back()+1);
                sum[i].push_back(sum[i].back()+p.second);
            }
            else{
                num[i].push_back(num[i].back()-1);
                sum[i].push_back(sum[i].back()+p.second);
            }
        }
    }
    ne=1;
    lcainit(n);
    ll wsum[w.size()+1];
    wsum[0]=0;
    rep(i,0,w.size())wsum[i+1]=wsum[i]+w[i];
    rep(i,1,n){
        //rep(j,0,vc[i].size())cout<<vc[i][j].first<<" "<<vc[i][j].second<<"    ";
        //cout<<endl;
    }//return 0;
    
    rep(i,0,q){
        ll x,y,f,g;cin>>x>>y>>f>>g;
        if(sen[f]>sen[g])swap(f,g);
        ll r=lca(f,g);
        //cout<<r<<" ";
        ll ans=0;
        pll p={sen[f],-inf};
        ll k=upper_bound(vc[x].begin(),vc[x].end(),p)-vc[x].begin();
        ll df=wsum[sen[f]],dg=wsum[sen[g]],dr=wsum[sen[r]];
        //cout<<k<<" ";
        //cout<<df<<" "<<dg<<" "<<dr<<endl;
        df+=-sum[x][k]+y*num[x][k];
        p={sen[g],-inf};
        k=upper_bound(vc[x].begin(),vc[x].end(),p)-vc[x].begin();
        dg+=-sum[x][k]+y*num[x][k];
        //cout<<k<<" ";
        p={sen[r],-inf};
        k=upper_bound(vc[x].begin(),vc[x].end(),p)-vc[x].begin();
        dr+=-sum[x][k]+y*num[x][k];
        //cout<<k<<endl;
        cout<<df+dg-2*dr<<endl;
        
    }
}


Measured memory_bytes: 91876