#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;
struct LCA {
	int N, s, K;
	vector< vector< int > > G;
	vector< vector< int > > kpar;
	vector< int > level;
	void dfs(int x, int p, int l) {
		kpar[0][x] = p;
		level[x] = l;
		for (auto j : G[x]) {
			if (j == p)
				continue;
			dfs(j, x, l + 1);
		}
	}
	LCA(const vector< vector< int > > &F, int _s) {
		G = F;
		s = _s;
		N = G.size();
		level.resize(N);
		K = 1;
		int c = 1;
		while (c < N) {
			K++;
			c *= 2;
		}
		rep(i, K) kpar.push_back(vector< int >(N));
		dfs(s, s, 0);
		rep(k, K) rep(i, N) {
			if (k == 0)
				continue;
			kpar[k][i] = kpar[k - 1][kpar[k - 1][i]];
		}
		//cout << level;
	}
	int calc(int u, int v) {
		int lu = level[u], lv = level[v];
		if (lv < lu) {
			swap(u, v);
			swap(lu, lv);
		}
		if (lu < lv) {
			for (int k = K - 1; k >= 0; k--) {
				if (lv - pow2(k) >= lu) {
					v = kpar[k][v];
					lv -= pow2(k);
				}
			}
		}
		if (u == v)
			return u;
		for (int k = K - 1; k >= 0; k--) {
			if (kpar[k][u] != kpar[k][v]) {
				u = kpar[k][u];
				v = kpar[k][v];
			}
		}
		return kpar[0][u];
	}
};
struct query {
	int x, y, u, v;
};
int N, M, K, T, Q, H, W;
void dfs(graph &G2, vector< int > &d, int dist, vector< int > &num, vector< int > &sum, vector< map< int, int > > &mpn, vector< map< int, int > > &mps, vector< vector< int > > &need, int x, int p) {
	rep(i, need[x].size()) {
		mps[x][need[x][i]] = sum[need[x][i]];
		mpn[x][need[x][i]] = num[need[x][i]];
	}
	d[x] = dist;
	for (auto e : G2[x]) {
		if (e.to == p)
			continue;
		num[e.c]++;
		sum[e.c] += e.d;
		dfs(G2, d, dist + e.d, num, sum, mpn, mps, need, e.to, x);
		sum[e.c] -= e.d;
		num[e.c]--;
	}
}
signed main() {
	cin >> N >> Q;
	vector< vector< int > > G(N);
	graph G2(N);
	rep(i, N - 1) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		--a;
		--b;
		--c;
		G[a].push_back(b);
		G[b].push_back(a);
		G2[a].emplace_back(a, b, d, c);
		G2[b].emplace_back(b, a, d, c);
	}
	LCA lca(G, 0);
	vector< query > Qs(Q);
	rep(i, Q) {
		cin >> Qs[i].x >> Qs[i].y >> Qs[i].u >> Qs[i].v;
		--Qs[i].u;
		--Qs[i].v;
		--Qs[i].x;
	}
	vector< int > num(N - 1, 0), sum(N - 1, 0);
	vector< vector< int > > need(N);
	vector< int > d(N, 0);
	rep(i, Q) {
		query q = Qs[i];
		need[q.u].push_back(q.x);
		need[q.v].push_back(q.x);
		need[lca.calc(q.u, q.v)].push_back(q.x);
	}
	vector< map< int, int > > mpn(N);
	vector< map< int, int > > mps(N);
	dfs(G2, d, 0, num, sum, mpn, mps, need, 0, -1);
	for (auto q : Qs) {
		int du = d[q.u] - mps[q.u][q.x] + mpn[q.u][q.x] * q.y;
		int dv = d[q.v] - mps[q.v][q.x] + mpn[q.v][q.x] * q.y;
		int l = lca.calc(q.u, q.v);
		int dl = d[l] - mps[l][q.x] + mpn[l][q.x] * q.y;
		cout << du + dv - 2LL * dl << endl;
	}
	return 0;
}

Measured memory_bytes: 94960