#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

class HeavyLightDecomposition {
    // [in[v], out[v]) に対応した列が v を頂点とした部分木に対応
public:
    int n;
    V< V<int> > edges;
    V<int> subsz;
    V<int> in, out, nxt;
    V<int> par;

    HeavyLightDecomposition(int n): n(n), edges(n), subsz(n, 0), in(n), out(n), nxt(n), par(n) {}

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

    void calc_subsz(int i, int p) {
        subsz[i] = 1;
        par[i] = p;
        if (edges[i].size() > 0 && edges[i][0] == p) swap(edges[i][0], edges[i].back());
        for (int ei = 0; ei < (int)edges[i].size(); ei++) {
            int e = edges[i][ei];
            if (e == p) continue;
            calc_subsz(e, i);
            subsz[i] += subsz[e];
            if (subsz[e] > subsz[edges[i][0]]) swap(edges[i][ei], edges[i][0]);
        }
    }

    void hld(int i, int p, int &t) {
        in[i] = t++;
        for (int e: edges[i]) {
            // nxt[e]: 分解した後の一番上の頂点
            // e が分解後の一番上 (e == edges[i][0]) なら、その上の頂点の nxt を代入
            if (e == p) continue;
            nxt[e] = (e == edges[i][0] ? nxt[i] : e);
            hld(e, i, t);
        }
        out[i] = t;
    }

    int lca(int u, int v) {
        while (true) {
            if (in[u] > in[v]) swap(u, v);
            if (nxt[u] == nxt[v]) return u;
            v = par[nxt[v]];
        }
    }
};

V<int> dist;
V< map<int, int> > colors_num, colors_dist;
V< set<int> > colors;
V<int> dfs_color_num, dfs_color_dist;
V< V< P<int, P<int, int> > > > edges;

void dfs(int i, int p, int d) {
    for (int c: colors[i]) {
        colors_num[i][c] = dfs_color_num[c];
        colors_dist[i][c] = dfs_color_dist[c];
    }

    dist[i] = d;
    for (P<int, P<int, int> > e: edges[i]) {
        if (e.first == p) continue;
        dfs_color_num[e.second.first]++;
        dfs_color_dist[e.second.first] += e.second.second;
        dfs(e.first, i, d + e.second.second);
        dfs_color_num[e.second.first]--;
        dfs_color_dist[e.second.first] -= e.second.second;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, q; cin >> n >> q;
    edges.resize(n);
    HeavyLightDecomposition HLD(n);
    for (int i = 1; i < n; i++) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        a--, b--;
        edges[a].emplace_back(make_pair(b, make_pair(c, d)));
        edges[b].emplace_back(make_pair(a, make_pair(c, d)));
        HLD.add_edge(a, b); HLD.add_edge(b, a);
    }
    HLD.calc_subsz(0, -1);
    int t = 0;
    HLD.hld(0, -1, t);
    colors.resize(n);
    V< P< P<int, int>, P<int, int> > > xyuv(q);
    for (int i = 0; i < q; i++) {
        int x, y, u, v; cin >> x >> y >> u >> v;
        u--, v--;
        xyuv[i] = make_pair( make_pair(x, y), make_pair(u, v) );
        int lca = HLD.lca(u, v);
        colors[u].insert(x), colors[v].insert(x), colors[lca].insert(x);
    }
    dfs_color_dist.resize(n, 0), dfs_color_num.resize(n, 0);
    colors_num.resize(n), colors_dist.resize(n);
    dist.resize(n);
    dfs(0, -1, 0);

    for (int i = 0; i < q; i++) {
        int x = xyuv[i].first.first, y = xyuv[i].first.second,
            u = xyuv[i].second.first, v = xyuv[i].second.second;
        int lca = HLD.lca(u, v);
        int nowd = dist[u] + dist[v] - 2 * dist[lca];
        nowd -= colors_dist[u][x] + colors_dist[v][x] - 2 * colors_dist[lca][x];
        nowd += (colors_num[u][x] + colors_num[v][x] - 2 * colors_num[lca][x]) * y;
        cout << nowd << '\n';
    }
    return 0;
}


Measured memory_bytes: 70860