#include <bits/stdc++.h>
using namespace std;

//It is increasingly evident that I forgot how tuples work.
typedef long long int lli;
typedef pair<lli, lli> ii;
#define mkpr make_pair

const int N = 1e5 + 5;

vector<vector<pair<pair<int, ii>, lli>>> adjList(N);

int n, q;
lli output[N];
pair<pair<ii, ii>, int> queries[N];
vector<vector<ii>> colors(N);

////Lowest Common Ancestor////

//DFS Traversal//
ii vLabels[2*N];

//Tells which index v first/last appears in
int vStart[N];
int vEnd[N];

int eStart[N];
int eEnd[N];

//Distance from the root
lli rootDist[N];

void dfsLabeler(int u, int par, int currDepth) {
	static int index = 0;
	vStart[u] = index;
	vLabels[index++] = mkpr(currDepth, u);
	for(auto vNest: adjList[u]) {
		int v = vNest.first.first;
		if(par != v) {
			rootDist[v] = rootDist[u] + vNest.first.second.second;
			eStart[vNest.second] = index;
			dfsLabeler(v, u, currDepth+1);
			vLabels[index++] = mkpr(currDepth, u);
			eEnd[vNest.second] = index-1;
		}
	}
	vEnd[u] = index-1;
}

//Rooted at 0
void init_labeling() {
	rootDist[0] = 0;
	dfsLabeler(0, -1, 0);
}
//End of DFS Traversal//

//Sparse Table//
ii sprs[2*N][20];

void init_sparse_table() {
	for(int i=0; i<2*N; i++) {
		sprs[i][0] = vLabels[i];
	}
	for(int j=1; j<20; j++) {
		for(int i=0; i+(1<<(j-1))<2*N; i++) {
			sprs[i][j] = min(sprs[i][j-1], sprs[i+(1<<(j-1))][j-1]);
		}
	}
}

ii getMinInTable(int a, int b) {
	if(a > b) {
		int temp = a; a = b; b = temp;
	}
	if(a==b) return sprs[a][0];
	int gap = b-a+1;
	int powTwo = -1;
	while(gap) {
		powTwo++;
		gap >>= 1;
	}
	return min(sprs[a][powTwo], sprs[b+1-(1<<powTwo)][powTwo]);
}
//End of Sparse Table//

int lca(int x, int y) {
	return getMinInTable(vStart[x], vStart[y]).second;
}

////End of Lowest Common Ancestor////

////Segment Tree For Colors////
ii t[4*N];

void modify(int l, int r, lli valCount, lli valDist) {
	for(l += 2*N, r += 2*N; l < r; l >>= 1, r >>= 1) {
		if(l&1) {
			t[l].first += valCount;
			t[l].second += valDist;
			l++;
		}
		if(r&1) {
			--r;
			t[r].first += valCount;
			t[r].second += valDist;
		}
	}
}

ii query(int p) {
	p += 2*N;
	ii sum = mkpr(0, 0);
	for(; p > 0; p >>= 1) {
		sum.first += t[p].first;
		sum.second += t[p].second;
	}
	return sum;
}

void init_tree() {
	for(int i = 0; i < 4*N; i++) t[i] = mkpr(0, 0);
}

void init_all() {
	init_labeling();
	init_sparse_table();
	init_tree();
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> q;

	int a, b, c, d;
	for(int i = 0; i < n-1; i++) {
		cin >> a >> b >> c >> d;
		a--; b--; c--;
		adjList[a].push_back(mkpr(mkpr(b, mkpr(c, d)), i));
		adjList[b].push_back(mkpr(mkpr(a, mkpr(c, d)), i));

		colors[c].push_back(mkpr(i, d));
	}

	init_all();

	for(int i = 0; i < q; i++) {
		int x, y, u, v;
		cin >> x >> y >> u >> v;
		x--;
		u--; v--;
		queries[i] = mkpr(mkpr(mkpr(x, y), mkpr(u, v)), i);
	}

	//Sort them by color
	sort(queries, queries + q);

	for(int i = 0; i < q; i++) {
		int x = queries[i].first.first.first;
		lli y = queries[i].first.first.second;
		int u = queries[i].first.second.first;
		int v = queries[i].first.second.second;
		if(i == 0 || x != queries[i-1].first.first.first) {
			if(i != 0) {
				int xAlt = queries[i-1].first.first.first;
				for(ii ei: colors[xAlt]) {
					modify(eStart[ei.first], eEnd[ei.first], -1, -ei.second);
				}
			}
			
			for(ii ei: colors[x]) {
				modify(eStart[ei.first], eEnd[ei.first], 1, ei.second);
			}
		}

		int herkunft = lca(u, v);
		lli baseAnswer = rootDist[u] - 2*rootDist[herkunft] + rootDist[v];

		ii query1 = query(vStart[u]);
		ii query2 = query(vStart[v]);
		ii query3 = query(vStart[herkunft]);

		ii modifi = mkpr(0, 0);
		modifi.first += query1.first;
		modifi.first -= 2*query3.first;
		modifi.first += query2.first;

		modifi.second += query1.second;
		modifi.second -= 2*query3.second;
		modifi.second += query2.second;

		lli answer = baseAnswer;
		answer -= modifi.second;
		answer += modifi.first*y;

		output[queries[i].second] = answer;
	}

	for(int i = 0; i < q; i++) {
		cout << output[i] << endl;
	}
	

	return 0;
}

Measured memory_bytes: 101108