#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

struct edge {int to;int color;int dist;};

vector<edge> G[100001];

vector<int> ans;
vector<P> vv[100001];
vector<P> vz[100001];
vector<int> yy;
vector<P> kk(100001,make_pair(0,0));

class LCA {
public:
    int V, logV;
    vector<int> depth, len;
    vector<vector<int> > parent;
    
    LCA(int V) {
        this->V = V;
        logV = 0;
        while (V > (1LL<<logV)) logV++;
        this->depth = vector<int>(V);
        this->len = vector<int>(V);
        this->parent = vector<vector<int> >(logV, vector<int>(V));
    }
    
    void init(int v, int par, int d, int l) {
        depth[v] = d;
        parent[0][v] = par;
        len[v] = l;
        for (int i = 0; i < (int)G[v].size(); i++) {
            int w = G[v][i].to;
            int lc = G[v][i].dist;
            if (w == par) continue;
            init(w, v, d+1, lc + l);
        }
    }
    
    void build() {
        for (int k = 0; k + 1 < logV; k++) {
            for (int v = 0; v < V; v++) {
                if (parent[k][v] < 0) parent[k+1][v] = -1;
                else parent[k+1][v] = parent[k][parent[k][v]];
            }
        }
    }
    
    int query(int u, int v) {
        if (depth[u] > depth[v]) swap(u, v);
        for (int k = 0; k < logV; k++) {
            if ((depth[v] - depth[u]) >> k & 1)
                v = parent[k][v];
        }
        if (u == v) return u;
        
        for (int k = logV-1; k >= 0; k--) {
            if (parent[k][u] != parent[k][v]) {
                u = parent[k][u];
                v = parent[k][v];
            }
        }
        return parent[0][u];
    }
};

void dfs(int v, int par) {
    for (int i = 0; i < vv[v].size(); i++) {
        ans[vv[v][i].sc]-=kk[vv[v][i].fs].fs-kk[vv[v][i].fs].sc*yy[vv[v][i].sc];
    }
    for (int i = 0; i < vz[v].size(); i++) {
        ans[vz[v][i].sc]+=2*kk[vz[v][i].fs].fs-2*kk[vz[v][i].fs].sc*yy[vz[v][i].sc];
    }
    for (int i = 0; i < (int)G[v].size(); i++) {
        int w = G[v][i].to;
        int lc = G[v][i].dist;
        if (w == par) continue;
        kk[G[v][i].color].fs+=G[v][i].dist;
        kk[G[v][i].color].sc++;
        dfs(w, v);
        kk[G[v][i].color].fs-=G[v][i].dist;
        kk[G[v][i].color].sc--;
    }
}


int main(){
    int n,q;cin >> n >> q;
    for (int i = 0; i < n-1; i++) {
        int a,b,c,d;cin >> a >> b >> c >> d;
        a--,b--,c--;
        G[a].pb({b,c,d});
        G[b].pb({a,c,d});
    }
    LCA lca(n+1);
    lca.init(0, -1, 0, 0);
    lca.build();
    for (int i = 0; i < q; i++) {
        int x,y,u,v;cin >> x >> y >> u >> v;
        u--,v--,x--;
        yy.pb(y);
        vv[u].pb(make_pair(x,i));
        vv[v].pb(make_pair(x,i));
        int z = lca.query(u,v);
        vz[z].pb(make_pair(x,i));
        ans.pb(lca.len[u]+lca.len[v]-2*lca.len[z]);
    }
    dfs(0,-1);
    for (int i = 0; i < q; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 30840