//root -> 頂点vの情報を事前に計算. dfsしながら差分計算.
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

struct Edge {
	int to, color, cost;
	Edge() { }
	Edge(int to, int color, int cost) { this->to = to; this->color = color; this->cost = cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int n, q;
Graph tree;
int x[100000], y[100000], u[100000], v[100000];

int parent[100000];
int depth[100000];
int length[100000];				//length[頂点v] = 頂点0->vの長さ
int parents[20][100000];

void dfs(int p, int v, int dep = 0, int len = 0) {
	int i;
	
	parent[v] = p;
	depth[v] = dep;
	length[v] = len;
	
	for (Edge e : tree[v]) {
		if (e.to == p) continue;
		dfs(v, e.to, dep + 1, len + e.cost);
	}
}

void prepare() {
	int i, j;
	rep(i, n) parents[0][i] = parent[i];
	rep(i, 19) {
		rep(j, n) {
			parents[i + 1][j] = parents[i][parents[i][j]];
		}
	}
}

int lca(int u, int v) {
	if (depth[u] < depth[v]) { swap(u, v); }
	
	int d = depth[u] - depth[v];
	for (int i = 19; i >= 0; i--) {
		if ((d >> i) & 1) {
			u = parents[i][u];
		}
	}
	
	for (int i = 19; i >= 0; i--) {
		if (parents[i][u] != parents[i][v]) {
			u = parents[i][u];
			v = parents[i][v];
		}
	}
	
	if (u == v) return u;
	return parent[u];
}

vector<int> queryC[100000];
map<int, int> cntMp[100000];	//cntMp[頂点v] = (色c, 頂点0->vで出現する本数)
map<int, int> costMp[100000];	//costMp[頂点v] = (色c, 頂点0->vでの合計長さ)
int cntC[100000];
int costC[100000];

void dfs2(int p, int v) {
	for (int c : queryC[v]) {
		cntMp[v][c] = cntC[c];
		costMp[v][c] = costC[c];
	}
	
	for (Edge e : tree[v]) {
		if (e.to == p) continue;
		
		cntC[e.color]++;
		costC[e.color] += e.cost;
		dfs2(v, e.to);
		cntC[e.color]--;
		costC[e.color] -= e.cost;
	}
}

int main() {
	int i;
	
	cin >> n >> q;
	tree.resize(n);
	
	rep(i, n - 1) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--; b--;
		tree[a].push_back(Edge(b, c, d));
		tree[b].push_back(Edge(a, c, d));
	}
	
	dfs(0, 0);
	prepare();
	
	rep(i, q) {
		cin >> x[i] >> y[i] >> u[i] >> v[i];
		u[i]--; v[i]--;
		int l = lca(u[i], v[i]);
		queryC[u[i]].push_back(x[i]);
		queryC[v[i]].push_back(x[i]);
		queryC[l].push_back(x[i]);
	}
	
	dfs2(0, 0);
	
	rep(i, q) {
		int l = lca(u[i], v[i]);
		int res = length[u[i]] + length[v[i]] - 2 * length[l];
		int honsu = cntMp[u[i]][x[i]] + cntMp[v[i]][x[i]] - 2 * cntMp[l][x[i]];
		int sumCost = costMp[u[i]][x[i]] + costMp[v[i]][x[i]] - 2 * costMp[l][x[i]];
		cout << res + honsu * y[i] - sumCost << endl;
	}
	return 0;
}