#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
  multi(ll first, ll second, ll third)
      : first(first), second(second), third(third) {}
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
typedef ll Weight;
struct Edge {
  ll col, dst;
  Weight weight;
  Edge(ll col, ll dst, Weight weight) : col(col), dst(dst), weight(weight) {}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

struct Queue {
  ll col, qid, coeff, y;
  Queue(ll col, ll qid, ll coeff, ll y)
      : col(col), qid(qid), coeff(coeff), y(y) {}
};
typedef vector<Queue> Queues;
typedef vector<Queues> QQ;

template <typename G> struct DoublingLowestCommonAncestor {
  const ll LOG;
  vector<ll> dep; // dep[j]=hは、j番目の要素の深さはh
  const G &g;
  // table[k][i]=pは、iの2^k回前親を辿ったのがp
  vector<vector<ll>> table;

  DoublingLowestCommonAncestor(const G &g) : g(g), dep(g.size()), LOG(30) {
    table.assign(LOG, vector<ll>(g.size(), -1));
  }

  void dfs(ll idx, ll par, ll d) {
    table[0][idx] = par;
    dep[idx] = d;
    for (auto &to : g[idx]) {
      if (to.dst != par)
        dfs(to.dst, idx, d + 1);
    }
  }

  void build() {
    dfs(0, -1, 0);
    for (ll k = 0; k + 1 < LOG; k++) {
      for (ll i = 0; i < table[k].size(); i++) {
        if (table[k][i] == -1)
          table[k + 1][i] = -1;
        else
          table[k + 1][i] = table[k][table[k][i]];
      }
    }
  }
  ll query(ll u, ll v) {
    ll inu = u, inv = v;
    if (dep[u] > dep[v])
      swap(u, v);
    for (ll i = LOG - 1; i >= 0; i--) {
      if (((dep[v] - dep[u]) >> i) & 1)
        v = table[i][v];
    }
    if (u == v)
      return u;
    for (ll i = LOG - 1; i >= 0; i--) {
      if (table[i][u] != table[i][v]) {
        u = table[i][u];
        v = table[i][v];
      }
    }
    return table[0][u];
  }
};

void func(Graph &g, vl &g2, ll s, ll p) {
  AUTO(i, g[s]) {
    if (i.dst != p) {
      g2[i.dst] = i.weight + g2[s];
      func(g, g2, i.dst, s);
    }
  }
  return;
}

void func2(Graph &g, vl &sum, vl &cnt, QQ &g3, ll s, ll p, vl &ans) {
  AUTO(i, g3[s]) {
    ll x = -sum[i.col];
    x += (ll)i.y * cnt[i.col];
    ans[i.qid] += x * i.coeff;
  }

  AUTO(i, g[s]) {
    if (i.dst != p) {
      cnt[i.col]++;
      sum[i.col] += i.weight;
      func2(g, sum, cnt, g3, i.dst, s, ans);
      cnt[i.col]--;
      sum[i.col] -= i.weight;
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, Q;
  cin >> N >> Q;
  Graph g(N + 1);
  vl g2(N + 1);
  QQ g3(N + 1);
  vl ans(Q, 0);
  REP(i, N - 1) {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;
    b--;
    g[a].push_back(Edge(c, b, d));
    g[b].push_back(Edge(c, a, d));
  }
  g2[0] = 0;
  func(g, g2, 0, -1);

  DoublingLowestCommonAncestor<Graph> lca(g);
  lca.build();

  REP(i, Q) {
    ll x, y, u, v;
    cin >> x >> y >> u >> v;
    u--;
    v--;
    ll lcap = lca.query(u, v);
    ans[i] = g2[u] + g2[v] - (g2[lcap] * 2);
    g3[u].push_back(Queue(x, i, 1, y));
    g3[v].push_back(Queue(x, i, 1, y));
    g3[lcap].push_back(Queue(x, i, -2, y));
  }
  vl cnt(N + 1, 0);
  vl sum(N + 1, 0);

  func2(g, sum, cnt, g3, 0, -1, ans);
  REP(i, Q) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 59244