#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 50;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

template <typename Monoid>
struct SegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid& M1) : f(f), M1(M1) {
        sz = 1;
        while (sz < n)
            sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid& x) {
        seg[k + sz] = x;
    }

    void build() {
        for (int k = sz - 1; k > 0; k--) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    void update(int k, const Monoid& x) {
        k += sz;
        seg[k] = x;
        while (k >>= 1) {
            seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
        }
    }

    Monoid query(int a, int b) {
        Monoid L = M1, R = M1;
        for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if (a & 1)
                L = f(L, seg[a++]);
            if (b & 1)
                R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int& k) const {
        return seg[k + sz];
    }
};

struct LowestCommonAncestor {
    int n, h;
    vector<vector<int>> G, par;
    vector<int> dep;
    LowestCommonAncestor() {}
    LowestCommonAncestor(int n) : n(n), G(n), dep(n) {
        h = 1;
        while ((1 << h) <= n)
            h++;
        par.assign(h, vector<int>(n, -1));
    }

    void add_edge(int u, int v) {
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }

    void dfs(int v, int p, int d) {
        par[0][v] = p;
        dep[v] = d;
        for (int u : G[v])
            if (u != p)
                dfs(u, v, d + 1);
    }

    void build(int r = 0) {
        dfs(r, -1, 0);
        for (int k = 0; k + 1 < h; k++)
            for (int v = 0; v < n; v++)
                if (~par[k][v])
                    par[k + 1][v] = par[k][par[k][v]];
    }

    int lca(int u, int v) {
        if (dep[u] > dep[v])
            swap(u, v);
        for (int k = 0; k < h; k++)
            if ((dep[v] - dep[u]) >> k & 1)
                v = par[k][v];

        if (u == v)
            return u;

        for (int k = h - 1; k >= 0; k--)
            if (par[k][u] != par[k][v])
                u = par[k][u], v = par[k][v];

        return par[0][u];
    }

    int distance(int u, int v) {
        return dep[u] + dep[v] - dep[lca(u, v)] * 2;
    }

    //先祖、子孫の順番のみtrue
    bool checkanc(int u, int v) {
        if (distance(u, v) + dep[u] == dep[v] && dep[u] != dep[v])
            return true;
        else
            return false;
    }
};


struct Node {
    int first, c, d;
};
struct Query {
    int x, y, u, v, i;
};
int N, Q;
vector<vector<Node>> G;
vector<Query> que;
vector<int> D;
vector<vector<int>> clr;
int L[101010], R[101010];
int ans[101010];

void dfs(int now, int par, int& idx) {
    for (auto& g : G[now]) {
        if (g.first == par)
            continue;
        L[g.first] = idx++;
        dfs(g.first, now, idx);
        R[g.first] = idx++;
    }
}
SegmentTree<int> seg(202020, [](int a, int b) { return a + b; }, 0);
SegmentTree<int> seg2(202020, [](int a, int b) { return a + b; }, 0);
SegmentTree<int> seg3(202020, [](int a, int b) { return a + b; }, 0);
void Set(int idx, int par) {
    for (auto& nxt : G[idx]) {
        if (nxt.first == par)
            continue;
        seg.set(L[nxt.first], -nxt.d);
        seg.set(R[nxt.first], nxt.d);
        Set(nxt.first, idx);
        clr[nxt.c].pb(nxt.first);
        D[nxt.first] = nxt.d;
    }
}

void solve() {
    R[0] = 2 * N - 2;
    clr.resize(N);
    D.resize(N);
    LowestCommonAncestor lca(N);
    FOR(N - 1) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--;
        b--;
        G[a].pb({b, c, d});
        G[b].pb({a, c, d});
        lca.add_edge(a, b);
    }
    lca.build();
    FOR(Q) {
        int x, y, u, v;
        cin >> x >> y >> u >> v;
        u--;
        v--;
        que.pb({x, y, u, v, i});
    }
    sort(all(que), [](Query a, Query b) { return a.x < b.x; });
    int idx = 0;
    dfs(0, -1, idx);
    Set(0, -1);
    seg.build();
    seg2.build();
    seg3.build();

    int done = 0;
    idx = 0;
    while (true) {
        int C;
        C = que[done].x;
        queue<int> q;
        for (auto& a : clr[C]) {
            q.push(a);
            seg2.update(L[a], -D[a]);
            seg2.update(R[a], D[a]);
            seg3.update(L[a], -1);
            seg3.update(R[a], 1);
            //cerr << C << " " << a + 1 << " " << L[a] << " " << R[a] << endl;
        }

        while (true) {
            if (done == Q || que[done].x != C) {
                break;
            }
            //クエリを処理
            int u = que[done].u;
            int v = que[done].v;
            int lc = lca.lca(u, v);

            int total = seg.query(R[u], R[lc]) + seg.query(R[v], R[lc]);
            int dif = que[done].y * (seg3.query(R[u], R[lc]) + seg3.query(R[v], R[lc])) - seg2.query(R[u], R[lc]) - seg2.query(R[v], R[lc]);

            ans[que[done].i] = total + dif;

            /*
            cerr << total << " "
                 << dif << " "
                 << seg3.query(R[u], R[lc]) << " "
                 << seg3.query(R[v], R[lc])
                 << endl;
*/
            done++;
        }

        while (!q.empty()) {
            int a = q.front();
            q.pop();
            seg2.update(L[a], 0);
            seg2.update(R[a], 0);
            seg3.update(L[a], 0);
            seg3.update(R[a], 0);
        }

        if (done == Q)
            break;
    }
    FOR(Q) {
        cout << ans[i] << endl;
    }
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> Q;
    G.resize(N);


    solve();
    return 0;
}


Measured memory_bytes: 57320