#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int to[200001],nex[200001],val[200001],col[200001],st[100001];
int fa[100001],son[100001],top[100001],dep[100001],siz[100001],sum[100001];
int ans[100001],colsum[100001],colnum[100001];
int n,m,cnt;
vector<int>c1[100001],c2[100001],id[100001],imp[100001];
void addedge(int x,int y,int v,int color)
{
    to[++cnt]=y;
    val[cnt]=v;
    col[cnt]=color;
    nex[cnt]=st[x];
    st[x]=cnt;
}
void dfs1(int x)
{
    dep[x]=dep[fa[x]]+1;
    siz[x]=1;
    for(int i=st[x];i;i=nex[i])
    {
        if(to[i]==fa[x])continue;
        fa[to[i]]=x;
        sum[to[i]]=sum[x]+val[i];
        dfs1(to[i]);
        siz[x]+=siz[to[i]];
        if(siz[to[i]]>siz[son[x]])son[x]=to[i];
    }
}
void dfs2(int x,int f)
{
    top[x]=f;
    if(son[x])dfs2(son[x],f);
    for(int i=st[x];i;i=nex[i])
    {
        if(to[i]==son[x]||to[i]==fa[x])continue;
        dfs2(to[i],to[i]);
    }
}
int LCA(int x,int y)
{
    while(top[x]!=top[y])
    {
        if(dep[top[x]]<dep[top[y]])swap(x,y);
        x=fa[top[x]];
    }
    if(dep[x]>dep[y])swap(x,y);
    return x;
}
void dfs(int x)
{
    for(int i=0;i<id[x].size();i++)
    {
        ans[id[x][i]]-=colsum[c1[x][i]]*imp[x][i];
        ans[id[x][i]]+=colnum[c1[x][i]]*c2[x][i]*imp[x][i];
    }
    for(int i=st[x];i;i=nex[i])
    {
        if(to[i]==fa[x])continue;
        colsum[col[i]]+=val[i];
        colnum[col[i]]++;
        dfs(to[i]);
        colsum[col[i]]-=val[i];
        colnum[col[i]]--;
    }
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<n;i++)
    {
        int x,y,v,color;
        //cin>>x>>y>>color>>v;
        scanf("%d%d%d%d",&x,&y,&color,&v);
        addedge(x,y,v,color);
        addedge(y,x,v,color);
    }
    dfs1(1);
    dfs2(1,1);
    //cout<<sum[4]-sum[1];
    //cout<<LCA(4,3)<<endl;
    for(int i=1;i<=m;i++)
    {
        int x,y,u,v,z;
        //cin>>u>>v>>x>>y;
        scanf("%d%d%d%d",&u,&v,&x,&y);
        z=LCA(x,y);
        ans[i]=sum[x]+sum[y]-2*sum[z];
        c1[x].push_back(u);
        c2[x].push_back(v);
        id[x].push_back(i);
        imp[x].push_back(1);
        c1[y].push_back(u);
        c2[y].push_back(v);
        id[y].push_back(i);
        imp[y].push_back(1);
        c1[z].push_back(u);
        c2[z].push_back(v);
        id[z].push_back(i);
        imp[z].push_back(-2);
    }
    dfs(1);
    for(int i=1;i<=m;i++)
    {
        //cout<<ans[i]<<endl;
        printf("%d\n",ans[i]);
    }
    return 0;
}