#include <bits/stdc++.h>
using namespace std;

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

class lca_solver {
public:
    vector<vector<int>> children;
    int root;
    // if root,parent is -1.
    vector<int> parent;
    vector<int> depth;
    vector<vector<int>> parent_pow2;
    lca_solver(vector<vector<int>> &children_, int root_)
            : children(children_), root(root_) {
        calc_parent_and_depth();
        calc_parent_pow2();
    };
    int lca(int u, int v) {
        // make sure depth(u) > depth(v).
        if (depth[u] < depth[v]) swap(u, v);
        for (size_t k = 0; k < parent_pow2.size(); k++) {
            if (((depth[u] - depth[v]) >> k) & 1) {
                u = parent_pow2[k][u];
            }
        }
        if (u == v) return u;
        for (int k = (int)parent_pow2.size() - 1; k >= 0; k--) {
            if (parent_pow2[k][u] != parent_pow2[k][v]) {
                u = parent_pow2[k][u];
                v = parent_pow2[k][v];
            }
        }
        return parent_pow2[0][u];
    }
    int dist(int u, int v) {
        return depth[u] + depth[v] - depth[lca(u, v)] * 2;
    }

private:
    void calc_parent_and_depth() {
        parent = vector<int>(children.size(), -1);
        depth = vector<int>(children.size(), -1);
        sub_calc_parent_and_depth(root, -1, 0);
    }
    void sub_calc_parent_and_depth(int cur, int par, int dep) {
        parent[cur] = par;
        depth[cur] = dep;
        for (int child : children[cur]) {
            if (child != par) {
                sub_calc_parent_and_depth(child, cur, dep + 1);
            }
        }
    }
    void calc_parent_pow2() {
        // parent_pow2[k][i] = 2^k parent of node i.
        parent_pow2 = vector<vector<int>>(ceil(log(children.size()) / log(2) + 1),
                                          vector<int>(children.size(), -1));
        parent_pow2[0] = parent;
        for (size_t k = 0; k + 1 < parent_pow2.size(); k++) {
            for (size_t v = 0; v < children.size(); v++) {
                if (parent_pow2[k][v] >= 0) {
                    parent_pow2[k + 1][v] = parent_pow2[k][parent_pow2[k][v]];
                }
            }
        }
    }
};

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N,Q;
    cin >> N >> Q;

    using tup=tuple<i64,i64,i64>;
    vector<vector<tup>> tree(N);
    rep(i,0,N-1){
        i64 a,b,c,d;
        cin >> a >> b >> c >> d;
        --a;
        --b;
        tree[a].emplace_back(make_tuple(b,c,d));
        tree[b].emplace_back(make_tuple(a,c,d));
    }

    i64 root;
    rep(i,0,N){
        if(tree[i].size()>1) continue;
        root=i;
        break;
    }

    vector<vector<int>> children(N);
    function<void(i64,i64)> dfs=[&](i64 u,i64 p){
        for(auto e:tree[u]){
            i64 v,c,d;
            tie(v,c,d)=e;
            if(v==p) continue;
            children[u].emplace_back(v);
            dfs(v,u);
        }
    };

    dfs(root,-1);
    lca_solver ls(children,root);

    vector<i64> x(Q),y(Q),u(Q),v(Q);
    vector<vector<i64>> req(N);
    rep(i,0,Q){
        cin >> x[i] >> y[i] >> u[i] >> v[i];
        --u[i];
        --v[i];

        i64 w=ls.lca(u[i],v[i]);
        req[u[i]].emplace_back(x[i]);
        req[v[i]].emplace_back(x[i]);
        req[w].emplace_back(x[i]);
    }

    vector<map<i64,i64>> dd(N),cc(N);
    vector<i64> dist(N),count(N),sum(N);
    function<void(i64,i64,i64)> rec=[&](i64 u,i64 p,i64 s){
        for(auto c:req[u]){
            dd[u][c]=dist[c];
            cc[u][c]=count[c];
        }
        sum[u]=s;
        for(auto e:tree[u]){
            i64 v,c,d;
            tie(v,c,d)=e;
            if(v==p) continue;
            dist[c]+=d;
            count[c]++;
            rec(v,u,s+d);
            dist[c]-=d;
            count[c]--;
        }
    };

    rec(root,-1,0);

    print(root);

    rep(i,0,Q){
        i64 w=ls.lca(u[i],v[i]);

        i64 ans=0;
        ans+=sum[u[i]]+sum[v[i]]-2*sum[w];
        print(w);
        print(sum[u[i]]);
        print(sum[v[i]]);
        print(sum[w]);
        print(ans);
        ans-=dd[u[i]][x[i]]+dd[v[i]][x[i]]-2*dd[w][x[i]];
        ans+=y[i]*(cc[u[i]][x[i]]+cc[v[i]][x[i]]-2*cc[w][x[i]]);
        cout << ans << endl;
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 83192