#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 20;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

pair<pair<int,int>, pair<int, int>> E[200001];
int H[100001];
int P[100001][17];
int D[100001], RD[100001];

int oya(int A, int B) {
	if (B == 0) return A;
	int k = 31 - __builtin_clz(B);
	return oya(P[A][k], B - (1 << k));
}
void dfs(int A, int prev, int rd, int d) {
	RD[A] = rd;
	D[A] = d;
	P[A][0] = prev;
	int mae = prev;
	rep(i, 16) {
		P[A][i + 1] = P[mae][i];
		mae = P[A][i + 1];
	}
	for (int i = H[A]; i; i = E[i].first.second) {
		if (E[i].first.first != prev) dfs(E[i].first.first, A, rd + E[i].second.first, d + 1);
	}
}

pair<int, int> QE[300001];
int QH[100001];
int CD[100001], CN[100001];
void dfs2(int A, int C) {
	int tmp;
	for (int i = QH[A]; i; i = tmp) {
		tmp = QE[i].second;
		QE[i].second = CN[QE[i].first];
		QE[i].first = CD[QE[i].first];
	}
	for (int i = H[A]; i; i = E[i].first.second) {
		if (E[i].first.first != C) {
			CD[E[i].second.second] += E[i].second.first;
			CN[E[i].second.second]++;
			dfs2(E[i].first.first, A);
			CD[E[i].second.second] -= E[i].second.first;
			CN[E[i].second.second]--;
		}
	}
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	
	int N = getint(), Q = getint();
	for (int i = 1; i < N + N - 1; i++) {
		int a = getint(), b = getint(), c = getint(), d = getint();
		E[i] = mp(mp(b, H[a]), mp(d, c));
		H[a] = i++;
		E[i] = mp(mp(a, H[b]), mp(d, c));
		H[b] = i;
	}

	dfs(1, 0, 0, 0);

	int motoD[100000], y[100000];
	rep(i, Q) {
		int x = getint();
		y[i] = getint();
		int u = getint(), v = getint();

		if (D[u] > D[v]) swap(u, v);
		int sa = D[v] - D[u];

		int u2 = u;
		int v2 = oya(v, sa);
		int lca = u;
		if (u2 != v2) {
			for (int k = 16; k >= 0; k--) {
				if (P[u2][k] != P[v2][k]) {
					u2 = P[u2][k];
					v2 = P[v2][k];
				}
			}
			lca = P[u2][0];
		}
		motoD[i] = RD[u] + RD[v] - RD[lca] * 2;
		QE[i * 3 + 1] = mp(x, QH[u]);
		QH[u] = i * 3 + 1;
		QE[i * 3 + 2] = mp(x, QH[v]);
		QH[v] = i * 3 + 2;
		QE[i * 3 + 3] = mp(x, QH[lca]);
		QH[lca] = i * 3 + 3;
	}

	dfs2(1, 0);

	rep(i, Q) {
		motoD[i] -= QE[i * 3 + 1].first + QE[i * 3 + 2].first - 2 * QE[i * 3 + 3].first;
		motoD[i] += (QE[i * 3 + 1].second + QE[i * 3 + 2].second - 2 * QE[i * 3 + 3].second) * y[i];
		co(motoD[i]);
	}

	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 19840