#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

#define MAX_N 100000
#define MAX_LOG_N 20

struct LCA {
    vector<int> G[MAX_N];
    int root;

    int parent[MAX_LOG_N][MAX_N];
    int depth[MAX_N];

    void dfs(int v, int p, int d){
        parent[0][v] = p;
        depth[v] = d;
        for(int i = 0; i < G[v].size(); i++){
            if(G[v][i] != p) dfs(G[v][i], v, d+1);
        }
    }

    void init(int V){
        dfs(root, -1, 0);
        for(int k = 0; k+1 < MAX_LOG_N; 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 lca(int u, int v){
        if(depth[u] > depth[v]) swap(u,v);
        for(int k = 0; k < MAX_LOG_N; k++){
            if((depth[v]-depth[u]) >> k & 1){
                v = parent[k][v];
            }
        }
        if(u == v) return u;
        for(int k = MAX_LOG_N - 1; k >= 0; k--){
            if(parent[k][u] != parent[k][v]){
                u = parent[k][u];
                v = parent[k][v];
            }
        }
        return parent[0][u];
    }
} lca;

struct Edge {
    int to, c, d;
};

int n, q;
vector<Edge> es[MAX_N];

vector<pl> col_n[MAX_N], col_l[MAX_N];
vector<ll> e_len;
int e_pos[MAX_N];

int euler_tour(int v, int p, int ind) {
    e_pos[v] = ind;
    for (Edge& e : es[v]) {
        if (e.to == p) continue;
        col_n[e.c].push_back(pl(ind,1));
        col_l[e.c].push_back(pl(ind,e.d));
        e_len.push_back(e.d);
        ind = euler_tour(e.to, v, ind+1);
        col_n[e.c].push_back(pl(ind,-1));
        col_l[e.c].push_back(pl(ind,-e.d));
        e_len.push_back(-e.d);
        ind++;
    }
    return ind;
}

int main() {
    cin >> n >> q;
    rep(i,n-1) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        a--; b--;
        es[a].push_back(Edge{b,c,d});
        es[b].push_back(Edge{a,c,d});
        lca.root = 0;
        lca.G[a].push_back(b);
        lca.G[b].push_back(a);
    }
    lca.init(n);
    euler_tour(0, 0, 0);
    rep(i,n) {
        for (int j = 1; j < (int)col_n[i].size(); j++) {
            col_n[i][j].second += col_n[i][j-1].second;
        }
        for (int j = 1; j < (int)col_l[i].size(); j++) {
            col_l[i][j].second += col_l[i][j-1].second;
        }
    }
    for (int i = 1; i < (int)e_len.size(); i++) {
        e_len[i] += e_len[i-1];
    }
    rep(i,q) {
        int x, y, u, v;
        cin >> x >> y >> u >> v;
        u--; v--;
        int p = lca.lca(u,v);
        ll dist = 0;
        dist = (e_pos[u]==0?0:e_len[e_pos[u]-1]) + (e_pos[v]==0?0:e_len[e_pos[v]-1]) - 2*(e_pos[p]==0?0:e_len[e_pos[p]-1]);
        ll cnt = 0;
        int tmp;
        tmp = lower_bound(col_n[x].begin(), col_n[x].end(), pl(e_pos[u],-linf))-col_n[x].begin();
        if (tmp) cnt += col_n[x][tmp-1].second;
        tmp = lower_bound(col_n[x].begin(), col_n[x].end(), pl(e_pos[v],-linf))-col_n[x].begin();
        if (tmp) cnt += col_n[x][tmp-1].second;
        tmp = lower_bound(col_n[x].begin(), col_n[x].end(), pl(e_pos[p],-linf))-col_n[x].begin();
        if (tmp) cnt -= col_n[x][tmp-1].second*2;
        dist += cnt * y;
        cnt = 0;
        tmp = lower_bound(col_l[x].begin(), col_l[x].end(), pl(e_pos[u],-linf))-col_l[x].begin();
        if (tmp) cnt += col_l[x][tmp-1].second;
        tmp = lower_bound(col_l[x].begin(), col_l[x].end(), pl(e_pos[v],-linf))-col_l[x].begin();
        if (tmp) cnt += col_l[x][tmp-1].second;
        tmp = lower_bound(col_l[x].begin(), col_l[x].end(), pl(e_pos[p],-linf))-col_l[x].begin();
        if (tmp) cnt -= col_l[x][tmp-1].second*2;
        dist -= cnt;
        cout << dist << endl;
    }
}


Measured memory_bytes: 40536