#include <bits/stdc++.h>
#define MOD 1000000007
int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rll() {
	long long n;
	scanf("%lld", &n);
	return n;
}

struct Hen {
	int a;
	int b;
	int color;
	int dist;
};

std::vector<Hen> a;
std::vector<std::vector<Hen> > hen;
int n, q;

std::vector<std::vector<Hen> > child;
std::vector<int> parent;
std::vector<int64_t> dist;
std::vector<int> depth;
std::vector<std::vector<int> > up;
std::vector<std::map<int, std::pair<int, int> > > qpool;
void dfs1(int i, int par, int64_t _dist, int _depth) {
	if (i) {
		int cur = par;
		int pos = 0;
		up[i].push_back(cur);
		// std::cerr << "i:" << i << " cur:" << cur << std::endl;
		while (1) {
			// std::cerr << cur << std::endl;
			if ((int) up[cur].size() <= pos) break;
			assert(cur != i);
			cur = up[cur][pos];
			pos++;
			up[i].push_back(cur);
		}
	}
	parent[i] = par;
	dist[i] = _dist;
	depth[i] = _depth;
	for (auto j : hen[i]) {
		if (j.b == par) continue;
		child[i].push_back(j);
		dfs1(j.b, i, _dist + j.dist, _depth + 1);
	}
}
int lca(int i, int j) {
	if (i == j) return i;
	if (depth[i] > depth[j]) std::swap(i, j);
	if (!i) return 0;
	int change = depth[j] - depth[i];
	int beki = 0;
	while (change) {
		if (change & 1 << beki) {
			assert((int) up[j].size() > beki);
			j = up[j][beki];
			change -= 1 << beki;
		}
		beki++;
	}
	assert(up[i].size() == up[j].size());
	assert(depth[i] == depth[j]);
	if (i == j) return i;
	beki = 20;
	while (beki) {
		assert(up[i].size() == up[j].size());
		beki--;
		if (beki >= (int) up[i].size()) continue;
		if (up[i][beki] == up[j][beki]) continue;
		i = up[i][beki];
		j = up[j][beki];
	}
	assert(i != j);
	assert(parent[i] == parent[j]);
	return parent[i];
}
void dfs2(int i, std::vector<std::pair<int, int> > &cur) {
	// qpool[i]
	for (auto &j : qpool[i]) j.second = cur[j.first];
	for (auto &j : child[i]) {
		cur[j.color].second += j.dist;
		cur[j.color].first++;
		dfs2(j.b, cur);
		cur[j.color].first--;
		cur[j.color].second -= j.dist;
	}
}


int main() {
	n = ri(), q = ri();
	a.resize(n - 1);
	hen.resize(n);
	for (int i = 0; i + 1 < n; i++) {
		int aa = ri() - 1;
		int b = ri() - 1;
		int c = ri() - 1;
		int d = ri();
		a[i] = {aa, b, c, d};
		hen[aa].push_back(a[i]);
		hen[b].push_back({b, aa, c, d});
	}
	parent.resize(n);
	child.resize(n);
	dist.resize(n);
	depth.resize(n);
	up.resize(n);
	dfs1(0, -1, 0, 0);
	std::cerr << "dfs1 finished" << std::endl;
	qpool.resize(n);
	std::vector<int> c(q), l(q), lc(q);
	std::vector<std::pair<int, int> > v(q);
	for (int i = 0; i < q; i++) {
		c[i] = ri() - 1, l[i] = ri();
		v[i] = {ri() - 1, ri() - 1};
		lc[i] = lca(v[i].first, v[i].second);
		qpool[v[i].first][c[i]] = {0, 0};
		qpool[v[i].second][c[i]] = {0, 0};
		qpool[lc[i]][c[i]] = {0, 0};
	}
	std::vector<std::pair<int, int> > cur(n);
	dfs2(0, cur);
	for (int i = 0; i < q; i++) {
		int res = dist[v[i].first] + dist[v[i].second] - 2 * dist[lc[i]];
		res += qpool[v[i].first][c[i]].first * l[i] - qpool[v[i].first][c[i]].second;
		res += qpool[v[i].second][c[i]].first * l[i] - qpool[v[i].second][c[i]].second;
		res -= 2 * (qpool[lc[i]][c[i]].first * l[i] - qpool[lc[i]][c[i]].second);
		std::cout << res << std::endl;
	}
	
	return 0;
}


Measured memory_bytes: 52736