#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
using CostType = long long;
struct Edge {
  int src, dst, c; CostType cost;
  Edge(int src, int dst, int c, CostType cost = 0) : src(src), dst(dst), c(c), cost(cost) {}
  inline bool operator<(const Edge &rhs) const {
    return cost != rhs.cost ? cost < rhs.cost : dst != rhs.dst ? dst < rhs.dst : src < rhs.src;
  }
  inline bool operator<=(const Edge &rhs) const { return cost <= rhs.cost; }
  inline bool operator>(const Edge &rhs) const {
    return cost != rhs.cost ? cost > rhs.cost : dst != rhs.dst ? dst > rhs.dst : src > rhs.src;
  }
  inline bool operator>=(const Edge &rhs) const { return cost >= rhs.cost; }
};

set<int> need[100000];
map<int, int> cnt[100000], total[100000];

struct LCA {
  vector<int> depth;
  vector<CostType> d;

  LCA(const vector<vector<Edge> > &graph) : graph(graph) {
    n = graph.size();
    depth.resize(n);
    d.resize(n);
    while ((1 << table_h) <= n) ++table_h;
    parent.resize(table_h, vector<int>(n));
  }

  void build(int root = 0) {
    vector<int> now_cnt(n - 1, 0), now_total(n - 1, 0);
    dfs(-1, root, 0, 0, now_cnt, now_total);
    for (int i = 0; i + 1 < table_h; ++i) REP(ver, n) {
      parent[i + 1][ver] = (parent[i][ver] == -1 ? -1 : parent[i][parent[i][ver]]);
    }
  }

  int query(int u, int v) {
    if (depth[u] > depth[v]) swap(u, v);
    REP(i, table_h) {
      if ((depth[v] - depth[u]) >> i & 1) v = parent[i][v];
    }
    if (u == v) return u;
    for (int i = table_h - 1; i >= 0; --i) {
      if (parent[i][u] != parent[i][v]) {
        u = parent[i][u];
        v = parent[i][v];
      }
    }
    return parent[0][u];
  }

  CostType dist(int u, int v) { return d[u] + d[v] - d[query(u, v)] * 2; }

private:
  int n, table_h = 1;
  vector<vector<Edge> > graph;
  vector<vector<int> > parent;

  void dfs(int par, int ver, int now_depth, CostType now_dist, vector<int> &now_cnt, vector<int> &now_total) {
    depth[ver] = now_depth;
    d[ver] = now_dist;
    parent[0][ver] = par;
    for (int e : need[ver]) {
      cnt[ver][e] = now_cnt[e];
      total[ver][e] = now_total[e];
    }
    for (Edge e : graph[ver]) {
      if (e.dst != par) {
        ++now_cnt[e.c];
        now_total[e.c] += e.cost;
        dfs(ver, e.dst, now_depth + 1, now_dist + e.cost, now_cnt, now_total);
        --now_cnt[e.c];
        now_total[e.c] -= e.cost;
      }
    }
  }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, q; cin >> n >> q;
  vector<vector<Edge> > graph(n);
  REP(_, n - 1) {
    int a, b, c, d; cin >> a >> b >> c >> d; --a; --b; --c;
    graph[a].emplace_back(Edge(a, b, c, d));
    graph[b].emplace_back(Edge(b, a, c, d));
  }
  LCA lca(graph);
  lca.build();
  vector<int> x(q), y(q), u(q), v(q);
  REP(i, q) {
    cin >> x[i] >> y[i] >> u[i] >> v[i]; --x[i]; --u[i]; --v[i];
    need[u[i]].emplace(x[i]);
    need[v[i]].emplace(x[i]);
    need[lca.query(u[i], v[i])].emplace(x[i]);
  }
  lca.build();
  REP(i, q) {
    long long ans = lca.dist(u[i], v[i]);
    ans -= total[u[i]][x[i]] + total[v[i]][x[i]] - total[lca.query(u[i], v[i])][x[i]] * 2;
    ans += y[i] * (cnt[u[i]][x[i]] + cnt[v[i]][x[i]] - cnt[lca.query(u[i], v[i])][x[i]] * 2);
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 77364