#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

// Heavy-Light Decomposition of trees
// Based on <http://beet-aizu.hatenablog.com/entry/2017/12/12/235950>
struct HeavyLightDecomposition {
    int V;
    int k;
    int nb_heavy_path;
    std::vector<std::vector<int>> e;
    std::vector<int> par;  // par[i] = parent of vertex i (Default: -1)
    std::vector<int> depth;  // depth[i] = distance between root and vertex i
    std::vector<int> subtree_sz; // subtree size
    std::vector<int> heavy_child;  // heavy_child[i] = child of vertex i on heavy path (Default: -1)
    std::vector<int> tree_id;  // tree_id[i] = id of tree vertex i belongs to
    std::vector<int> aligned_id, aligned_id_inv;  // aligned_id[i] =  aligned id for vertex i (consecutive on heavy edges)
    std::vector<int> head;  // head[i] = id of vertex on heavy path of vertex i, nearest to root
    std::vector<int> head_ids;  // consist of head vertex id's
    std::vector<int> heavy_path_ids;  // heavy_path_ids[i] = heavy_path_id for vertex [i]

    HeavyLightDecomposition(int sz = 0) : V(sz), k(0), nb_heavy_path(0), e(sz), par(sz), depth(sz),
    subtree_sz(sz), heavy_child(sz), tree_id(sz, -1), aligned_id(sz), aligned_id_inv(sz), head(sz), heavy_path_ids(sz, -1) {}
    void add_edge(int u, int v) {
        e[u].emplace_back(v);
        e[v].emplace_back(u);
    }

    void _build_dfs(int root) {
        std::stack<pair<int, int>> st;
        par[root] = -1;
        depth[root] = 0;
        st.emplace(root, 0);
        while (!st.empty()) {
            int now = st.top().first;
            int &i = st.top().second;
            if (i < (int)e[now].size()) {
                int nxt = e[now][i++];
                if (nxt == par[now]) continue;
                par[nxt] = now;
                depth[nxt] = depth[now] + 1;
                st.emplace(nxt, 0);
            } else {
                st.pop();
                int max_sub_sz = 0;
                subtree_sz[now] = 1;
                heavy_child[now] = -1;
                for (auto nxt : e[now]) {
                    if (nxt == par[now]) continue;
                    subtree_sz[now] += subtree_sz[nxt];
                    if (max_sub_sz < subtree_sz[nxt]) max_sub_sz = subtree_sz[nxt], heavy_child[now] = nxt;
                }
            }
        }
    }

    void _build_bfs(int root, int tree_id_now) {
        std::queue<int> q({root});
        while (!q.empty()) {
            int h = q.front();
            q.pop();
            head_ids.emplace_back(h);
            for (int now = h; now != -1; now = heavy_child[now]) {
                tree_id[now] = tree_id_now;
                aligned_id[now] = k++;
                aligned_id_inv[aligned_id[now]] = now;
                heavy_path_ids[now] = nb_heavy_path;
                head[now] = h;
                for (int nxt : e[now]) if (nxt != par[now] and nxt != heavy_child[now]) q.push(nxt);
            }
            nb_heavy_path++;
        }
    }

    void build(std::vector<int> roots = {0}) {
        int tree_id_now = 0;
        for (auto r : roots) {
            _build_dfs(r);
            _build_bfs(r, tree_id_now++);
        }
    }

    // query for vertices on path [u, v] (INCLUSIVE)
    template<typename F>
    void for_each_vertex(int u, int v, const F& f) {
        while (true) {
            if (aligned_id[u] > aligned_id[v]) swap(u, v);
            f(max(aligned_id[head[v]], aligned_id[u]), aligned_id[v]);
            if (head[u] != head[v]) v = par[head[v]];
            else break;
        }
    }

    // query for edges on path [u, v]
    // template<typename F>
    void for_each_edge(int u, int v, const function<void(int, int)>& f)
    {
        while (true) {
            if (aligned_id[u] > aligned_id[v]) swap(u, v);
            if (head[u] != head[v]) {
                f(aligned_id[head[v]], aligned_id[v]);
                v = par[head[v]];
            }
            else {
                if (u != v) f(aligned_id[u] + 1, aligned_id[v]);
                break;
            }
        }
    }

    // lowest_common_ancestor: O(logV)
    int lowest_common_ancestor(int u, int v) {
        assert(tree_id[u] == tree_id[v] and tree_id[u] >= 0);
        while (true) {
            if (aligned_id[u] > aligned_id[v]) swap(u, v);
            if (head[u] == head[v]) return u;
            v = par[head[v]];
        }
    }

    int distance(int u, int v) {
        assert(tree_id[u] == tree_id[v] and tree_id[u] >= 0);
        return depth[u] + depth[v] - 2 * depth[lowest_common_ancestor(u, v)];
    }
};

// template <typename T>
using T = pair<int, map<int, pint>>;
struct SegTree
{
    int N;
    int head;
    vector<T> x;
    T defaultT;
    using func = function<T(const T&, const T&)>;
    func merger;
    pair<int, pint> _get(int begin, int end, int pos, int l, int r, int color)
    {
        if (r <= begin or l >= end) return {0, pint(0, 0)};
        if (l >= begin and r <= end) return {x[pos].first, x[pos].second[color]};
        pair<int, pint> p1 = _get(begin, end, 2 * pos + 1, l, (l + r) / 2, color);
        pair<int, pint> p2 = _get(begin, end, 2 * pos + 2, (l + r) / 2, r, color);
        return p1 + p2;
    }
    SegTree(int N, T defaultT, func merger) : N(N), defaultT(defaultT), merger(merger)
    {
        int N_tmp = 1; while (N_tmp < N) N_tmp <<= 1;
        x.assign(N_tmp*2, defaultT), head = N_tmp - 1;
    }
    SegTree(const vector<T> &vals, T defaultT, func merger) : N(vals.size()), defaultT(defaultT), merger(merger)
    {
        int N_tmp = 1; while (N_tmp < N) N_tmp <<= 1;
        x.assign(N_tmp*2, defaultT), head = N_tmp - 1;
        copy(vals.begin(), vals.end(), x.begin() + head);
        IREP(i, head) x[i] = merger(x[i * 2 + 1], x[i * 2 + 2]);
    }
    SegTree() : SegTree(0, T(), [](T, T) { return T(); }) {}
    void build(const vector<T> &vals) { copy(vals.begin(), vals.end(), x.begin() + head); IREP(i, head) x[i] = merger(x[i * 2 + 1], x[i * 2 + 2]); }
    void update(int pos, T val) { pos += head, x[pos] = val; while (pos) pos = (pos - 1) / 2, x[pos] = merger(x[pos*2+1], x[pos*2+2]); }
    pair<int, pint> get(int begin, int end, int color) { return _get(begin, end, 0, 0, (int)x.size() / 2, color); }
    // friend ostream &operator<<(ostream &os, const SegTree &s) { os << "["; REP(i, s.N) os << s.get(i, i + 1) << ","; os << "]"; return os; }
};
// 参考 要素数N・非負入力を想定したRange Maximum Query
// SegTree<int> rMq(N, 0, [](int a, int b) { return max(a, b); });

SegTree segtree(100002, make_pair(0, map<int, pint>{}),
                [](T a, T b) {
                    map<int, pint> ma = a.second;
                    for (auto pa : b.second)
                    {
                        ma[pa.first].first += pa.second.first;
                        ma[pa.first].second += pa.second.second;
                    }
                    return make_pair(a.first + b.first, ma);
                });
HeavyLightDecomposition hl;
vector<map<int, pint>> edges;

vector<pair<int, map<int, pint>>> stdata;
void dfs(int now, int prv)
{
    for (auto nxt : edges[now]) if (nxt.first != prv)
    {
        int v = hl.aligned_id[nxt.first];
        map<int, pint> ma;
        ma[nxt.second.first] = make_pair(1, nxt.second.second);
        stdata[v] = make_pair(nxt.second.second, ma);
        dfs(nxt.first, now);
    }
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<int> a(N - 1), b(N - 1), c(N - 1), d(N - 1);
    vector<int> x(Q), y(Q), u(Q), v(Q);

    edges.resize(N);
    REP(i, N - 1) cin >> a[i] >> b[i] >> c[i] >> d[i];
    REP(i, N - 1) a[i]--, b[i]--;
    REP(i, N - 1) edges[a[i]][b[i]] = edges[b[i]][a[i]] = make_pair(c[i], d[i]);

    hl = HeavyLightDecomposition(N);
    REP(i, N - 1) hl.add_edge(a[i], b[i]);
    hl.build();

    stdata.resize(N + 2);
    dfs(0, -1);
    segtree.build(stdata);

    REP(i, Q) cin >> x[i] >> y[i] >> u[i] >> v[i];
    REP(i, Q) u[i]--, v[i]--;
    REP(i, Q)
    {
        pair<int, pint> pa;
        hl.for_each_edge(u[i], v[i], [&](int l, int r) {
            pair<int, pint> tmp = segtree.get(l, r + 1, x[i]);
            pa = pa + tmp;
        });
        cout << pa.first - pa.second.second + pa.second.first * y[i] << endl;
    }
}


Measured memory_bytes: 205128