#include <bits/stdc++.h>

using namespace std;

#define int long long
// #define double long double
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt(x) __builtin_popcount(x)
#define lbit(x) __builtin_ffsll(x)
#define rbit(x) __builtin_clzll(x)
#define SZ(x) ((long long)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
#define cinfast() cin.tie(0), ios::sync_with_stdio(false)
#define PERM(c)                                                                \
    sort(All(c));                                                              \
    for(bool cp = true; cp; cp = next_permutation(All(c)))
#define MKORDER(n)                                                             \
    vector<int> od(n);                                                         \
    iota(All(od), 0LL);

template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    long long __VA_ARGS__;                                                     \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const double PI = atan(1.0) * 4.0;
const ll dw[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dh[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238

ll N, M;
struct edge {
    ll to, col, len;
};
vector<vector<edge>> g;

struct HLDecomposition {
    vector<set<int>> g;
    vector<int> vid, head, heavy, parent, depth, inv, in, out;
    HLDecomposition() {}
    HLDecomposition(int n) { init(n); }
    void init(int n) {
        g.resize(n);
        vid.resize(n, -1);
        head.resize(n);
        heavy.resize(n, -1);
        parent.resize(n);
        depth.resize(n);
        inv.resize(n);
        in.resize(n);
        out.resize(n);
    }
    void add(int u, int v) {
        g[u].insert(v);
        g[v].insert(u);
    }
    void build() {
        dfs(0, -1);
        t = 0;
        dfs_hld();
    }

    int dfs(int curr, int prev) {
        parent[curr] = prev;
        int sub = 1, max_sub = 0;
        heavy[curr] = -1;
        for(int next : g[curr])
            if(next != prev) {
                depth[next] = depth[curr] + 1;
                int sub_next = dfs(next, curr);
                sub += sub_next;
                if(max_sub < sub_next) max_sub = sub_next, heavy[curr] = next;
            }
        return sub;
    }

    int t = 0;
    void dfs_hld(int v = 0) {
        vid[v] = in[v] = t;
        t++;
        inv[in[v]] = v;
        if(0 <= heavy[v]) {
            head[heavy[v]] = head[v];
            dfs_hld(heavy[v]);
        }
        for(auto u : g[v])
            if(depth[v] < depth[u])
                if(u != heavy[v]) {
                    head[u] = u;
                    dfs_hld(u);
                }
        out[v] = t;
    }

    void foreach(int u, int v, function<void(int, int)> f) { // [x,y]
        if(vid[u] > vid[v]) swap(u, v);
        f(max(vid[head[v]], vid[u]), vid[v]);
        if(head[u] != head[v]) foreach(u, parent[head[v]], f)
                ;
    }
    int ancestor(int from, int times) {
        while(true) {
            if(depth[head[from]] > depth[from] - times) {
                times -= depth[from] - depth[head[from]] + 1;
                if(head[from] == 0) return -1;
                from = parent[head[from]];
            } else
                return inv[vid[from] - times];
        }
    }
    int lca(int u, int v) {
        if(vid[u] > vid[v]) swap(u, v);
        if(head[u] == head[v]) return u;
        return lca(u, parent[head[v]]);
    }
    int distance(int u, int v) {
        return depth[u] + depth[v] - 2 * depth[lca(u, v)];
    }
    int child(int parent, int child, int times) {
        assert(depth[parent] < depth[child]);
        int d = distance(parent, child);
        assert(times - 1 <= d);
        return ancestor(child, d - times);
    }
    int go(int from, int to, int times) {
        int d = distance(from, to);
        assert(0 <= times and times <= d);
        int lc = lca(from, to);
        if(lc == to) return ancestor(from, times);
        if(lc == from) return child(from, to, times);
        int dd = distance(from, lc);
        if(dd <= times) return go(lc, to, times - dd);
        return ancestor(from, times);
    }
};

ll ans[100100], clen[100100], ccnt[100100];
struct query {
    ll idx, col, len, mul;
};
vector<vector<query>> qs;

void dfs(ll now, ll par, ll d) {
    FOREACH(q, qs[now]) {
        ll idx = q.idx, col = q.col, len = q.len, mul = q.mul;
        ans[idx] += (d - clen[col] + ccnt[col] * len) * mul;
    }
    FOREACH(e, g[now]) {
        ll to = e.to, col = e.col, len = e.len;
        if(to == par) continue;
        clen[col] += len;
        ccnt[col]++;
        dfs(to, now, d + len);
        clen[col] -= len;
        ccnt[col]--;
    }
}

signed main() {
    cinfast();
    LCIN(N, Q);
    HLDecomposition hld(N);
    g.resize(N);
    REP(i, N - 1) {
        LCIN(a, b, c, d);
        a--, b--;
        g[a].push_back({b, c, d});
        g[b].push_back({a, c, d});
        hld.add(a, b);
    }
    hld.build();
    qs.resize(N);
    REP(i, Q) {
        LCIN(x, y, u, v);
        u--, v--;
        qs[u].push_back({i, x, y, 1});
        qs[v].push_back({i, x, y, 1});
        qs[hld.lca(u, v)].push_back({i, x, y, -2});
    }
    dfs(0, -1, 0);
    REP(i, Q) { cout << ans[i] << "\n"; }
}


Measured memory_bytes: 67440