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

typedef long long ll;
ll N, Q;
// w, c, d
vector<vector<tuple<ll, ll, ll>>> Adj;
const ll LEVEL = 20;
vector<vector<ll>> Anc;
vector<ll> Dist, Depth;
// query id, coefficient, x, y
vector<vector<tuple<ll, ll, ll, ll>>> Calc;
// (for each color) sum of lengths, number
vector<pair<ll, ll>> Info;
vector<ll> R;

void init_dfs(ll v, ll par, ll depth, ll dist) {
  Anc[0][v] = par;
  Depth[v] = depth;
  Dist[v] = dist;
  for (auto edge : Adj[v]) {
    ll w = get<0>(edge);
    if (w == par) continue;
    ll d = get<2>(edge);
    init_dfs(w, v, depth + 1, dist + d);
  }
}
ll lca(ll u, ll v) {
  if (Depth[u] > Depth[v]) swap(u, v);
  for (ll k = LEVEL - 1; k >= 0; --k) {
    if ((Depth[v] - Depth[u]) & (1 << k)) v = Anc[k][v];
  }
  if (u == v) return u;
  for (ll k = LEVEL - 1; k >= 0; --k) {
    if (Anc[k][u] != Anc[k][v]) {
      u = Anc[k][u];
      v = Anc[k][v];
    }
  }
  return Anc[0][u];
}
void dfs(ll v, ll par) {
  for (auto calc : Calc[v]) {
    ll i = get<0>(calc), coeff = get<1>(calc);
    ll x = get<2>(calc), y = get<3>(calc);
    R[i] += coeff * (Dist[v] - Info[x].first + y * Info[x].second);
  }
  for (auto edge : Adj[v]) {
    ll w = get<0>(edge);
    if (w == par) continue;
    ll c = get<1>(edge), d = get<2>(edge);
    Info[c].first += d;
    ++Info[c].second;
    dfs(w, v);
    Info[c].first -= d;
    --Info[c].second;
  }
}
int main() {
  cin >> N >> Q;
  Adj.resize(N);
  for (ll i = 0; i < N - 1; ++i) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    --a;
    --b;
    --c;
    Adj[a].push_back(make_tuple(b, c, d));
    Adj[b].push_back(make_tuple(a, c, d));
  }
  Anc.resize(LEVEL);
  for (auto &anc : Anc) anc.resize(N, -1);
  Depth.resize(N);
  Dist.resize(N);
  init_dfs(0, -1, 0, 0);
  for (ll k = 1; k < LEVEL; ++k) {
    for (ll v = 0; v < N; ++v) {
      if (Anc[k - 1][v] != -1) Anc[k][v] = Anc[k - 1][Anc[k - 1][v]];
    }
  }
  Calc.resize(N);
  for (ll i = 0; i < Q; ++i) {
    ll x, y, u, v;
    cin >> x >> y >> u >> v;
    --x;
    --u;
    --v;
    ll w = lca(u, v);
    Calc[u].push_back(make_tuple(i, 1, x, y));
    Calc[v].push_back(make_tuple(i, 1, x, y));
    Calc[w].push_back(make_tuple(i, -2, x, y));
  }
  Info.resize(N - 1);
  R.resize(Q);
  dfs(0, -1);
  for (ll r : R) cout << r << endl;
  return 0;
}
