#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr int MOD = 1e9 + 7; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

struct edge {
	int to, cost, color;
};

vector<edge>Graph[100010];

const int MAX_V = 100020;
const int MAX_LOG_V = 18;
vector<int> G[MAX_V];
int root;//根の番号

int parent[MAX_LOG_V][MAX_V];//親を2^k回辿って到達する頂点
int depth[MAX_V];

void dfs(int v, int p, int d) {
	parent[0][v] = p;
	depth[v] = d;
	for (int i = 0; i < G[v].size(); i++) {
		if (G[v][i] != p)dfs(G[v][i], v, d + 1);
	}
}

void init(int V) {
	dfs(root, -1, 0);
	for (int k = 0; k + 1 < MAX_LOG_V; k++) {
		for (int v = 0; v < V; v++) {
			if (parent[k][v] < 0)parent[k + 1][v] = -1;
			else parent[k + 1][v] = parent[k][parent[k][v]];
		}
	}
}

int lca(int u, int v) {
	if (depth[u] > depth[v]) {
		swap(u, v);
	}
	for (int k = 0; k < MAX_LOG_V; k++) {
		if ((depth[v] - depth[u]) >> k & 1) {
			v = parent[k][v];
		}
	}
	if (u == v)return u;
	for (int k = MAX_LOG_V - 1; k >= 0; k--) {
		if (parent[k][u] != parent[k][v]) {
			u = parent[k][u];
			v = parent[k][v];
		}
	}
	return parent[0][u];
}

struct query {
	int x, y, u, v;
};

vector<int>q_par[100010], q_chi[100010];
vector<query>qs;

int ans[100010];
void euler(int n, map<int, int>&sum, map<int, int>&cnt) {
	//print(n + 1);
	for (auto idx : q_par[n]) {
		int color = qs[idx].x;
		ans[idx] -= 2*cnt[color] * qs[idx].y;
		ans[idx] += 2 * sum[color];
	}
	for (auto idx : q_chi[n]) {
		int color = qs[idx].x;
		ans[idx] -= sum[color];
		ans[idx] += cnt[color] * qs[idx].y;
	}
	for (auto e : Graph[n]) {
		if (e.to == parent[0][n])continue;
		//if (e.to == 0)continue;
		cnt[e.color]++;
		sum[e.color] += e.cost;
		euler(e.to, sum, cnt);
	}

	for (auto e : Graph[n]) {
		if (e.to == parent[0][n]) {
			cnt[e.color]--;
			sum[e.color] -= e.cost;
		}
	}
}

int dist[100010];

void calc_dist(int n, int res) {
	dist[n] = res;
	for (auto e : Graph[n]) {
		if (e.to == parent[0][n])continue;
		calc_dist(e.to, res + e.cost);
	}
}

void solve() {
	int N, Q; cin >> N >> Q;
	REP(i, N - 1) {
		int u, v, c, d; cin >> u >> v >> c >> d;
		u--, v--;
		G[u].push_back(v);
		G[v].push_back(u);
		Graph[u].push_back({ v,d,c });
		Graph[v].push_back({ u,d,c });
	}
	root = 0;
	init(N);
	REP(i, Q) {
		int x, y, u, v; cin >> x >> y >> u >> v;
		u--, v--;
		qs.push_back({ x,y,u,v });
		int par = lca(u, v);
		q_par[par].push_back(i);
		q_chi[u].push_back(i);
		q_chi[v].push_back(i);
	}
	calc_dist(0, 0);
	map<int, int>sum, cnt;
	euler(0, sum, cnt);
	REP(i, Q) {
		ans[i] += dist[qs[i].u];
		ans[i] += dist[qs[i].v];
		int par = lca(qs[i].u, qs[i].v);
		ans[i] -= 2 * dist[par];
		print(ans[i]);
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 63212