#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

struct LCA {
    const int n = 0;
    const int log2_n = 0;
    vector<vector<int>> g;
    vector<vector<int>> par;  // par[2^i上][頂点v]
    vector<int> dep;

    void dfs(int v, int p, int d) {
        par[0][v] = p;
        dep[v] = d;
        for(auto to: g[v]) {
            if(to == p) continue;
            dfs(to, v, d+1);
        }
    }

    LCA() {}
    LCA(int n) : n(n), log2_n(log2(n)+1), g(n),
        par(log2_n, vector<int>(n)), dep(n) {}

    void add_edge(int u, int v) {
        g[u].push_back(v);
        g[v].push_back(u);
    }

    void build(ll root=0) {
        dfs(root, -1, 0);
        for(int i=0; i+1 < log2_n; ++i) {
            for(int j = 0; j < n; ++j) {
                if(par[i][j] < 0) par[i+1][j] = -1;
                else par[i+1][j] = par[i][par[i][j]];
            }
        }
    }

    int get(int u, int v) {
        if(dep[u] > dep[v]) swap(u, v);
        REP(i, log2_n) {
            if((dep[v] - dep[u]) >> i & 1) {
                v = par[i][v];
            }
        }
        if(u == v) return u;
        for(int i=log2_n-1; i>=0; --i) {
            if(par[i][u] != par[i][v]) {
                u = par[i][u];
                v = par[i][v];
            }
        }
        return par[0][u];
    }
};

int main(void) {
    ll n, q;
    cin >> n >> q;
    struct edge { ll to, col, dist; };
    vector<vector<edge>> g(n);
    LCA lca(n);
    REP(i, n-1) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        a--, b--, c--;
        g[a].push_back({b, c, d});
        g[b].push_back({a, c, d});
        lca.add_edge(a, b);
    }
    lca.build();
    vector<vector<pair<ll,bool>>> query(n);
    vector<ll> x(q), y(q);
    REP(i, q) {
        ll u, v;
        cin >> x[i] >> y[i] >> u >> v;
        x[i]--, u--, v--;
        query[u].push_back({i, false});
        query[v].push_back({i, false});
        query[lca.get(u, v)].push_back({i, true});
    }

    vector<ll> ans(q);
    function<void(ll, ll, ll, vector<PII>&)> dfs = [&](ll v, ll p, ll dist_sum, vector<PII>& state) {
        for(auto p: query[v]) {
            if(p.second) {
                ans[p.first] -= 2 * (dist_sum - state[x[p.first]].second + state[x[p.first]].first * y[p.first]);
            } else {
                ans[p.first] += dist_sum - state[x[p.first]].second + state[x[p.first]].first * y[p.first];
            }
        }
        for(auto e: g[v]) if(e.to != p) {
            state[e.col].first++;
            state[e.col].second += e.dist;
            dfs(e.to, v, dist_sum + e.dist, state);
            state[e.col].first--;
            state[e.col].second -= e.dist;
        }
    };
    vector<PII> state(n-1, PII(0, 0));
    dfs(0, -1, 0, state);

    REP(i, q) cout << ans[i] << "\n";
    cout << flush;

    return 0;
}

Measured memory_bytes: 44532