#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
#define int long long
vector<tuple<int,int, int>> vertexs[200000];
int final_ans[200000];
int depth[200000];
int back[200000][32] = {};
int dfs(int now, int before) {
	for (int q = 0; q < vertexs[now].size(); ++q) {
		if (get<0>(vertexs[now][q]) != before) {
			int next = get<0>(vertexs[now][q]);
			depth[next] = depth[now] + 1;
			back[next][0] = now;
			dfs(next, now);
		}
	}
	return 0;
}
int lca(int a, int b) {
	if (depth[a] > depth[b]) swap(a, b);
	if (depth[a] < depth[b]) {
		for (int q = 0;; ++q) {
			if (depth[a] > depth[b] - (1 << q)) {
				return lca(a, back[b][q - 1]);
			}
		}
	}
	else {
		if (a == b) return a;
		for (int q = 0;; ++q) {
			if (back[a][q] == back[b][q]) {
				return lca(back[a][max(q - 1, 0LL)], back[b][max(q - 1, 0LL)]);
			}
		}
	}
}
vector<tuple<int, int, int, int>> queries[200000];
pair<long long, long long> color_dist[200000];
long long normal_dist = 0;
int re_dfs(int now, int back) {
	REP(i, queries[now].size()) {
		int ans = normal_dist;
		int color = get<1>(queries[now][i]);
		ans -= color_dist[color].first;
		ans += color_dist[color].second * get<2>(queries[now][i]);
		final_ans[get<0>(queries[now][i])] += get<3>(queries[now][i]) * ans;
	}
	REP(i, vertexs[now].size()) {
		if (get<0>(vertexs[now][i]) != back) {
			normal_dist += get<2>(vertexs[now][i]);
			color_dist[get<1>(vertexs[now][i])].second++;
			color_dist[get<1>(vertexs[now][i])].first += get<2>(vertexs[now][i]);
			re_dfs(get<0>(vertexs[now][i]), now);
			normal_dist -= get<2>(vertexs[now][i]);
			color_dist[get<1>(vertexs[now][i])].second--;
			color_dist[get<1>(vertexs[now][i])].first -= get<2>(vertexs[now][i]);
		}
	}
	return 0;
}
#undef int
int main() {
#define int long long
	int n, query;
	cin >> n >> query;
	REP(i, n - 1) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--;
		b--;
		vertexs[a].push_back(make_tuple(b, c, d));
		vertexs[b].push_back(make_tuple(a, c, d));
	}
	dfs(0, -1);
	for (int i = 0; i < 30; ++i) {
		for (int q = 0; q < n; ++q) {
			back[q][i + 1] = back[back[q][i]][i];
		}
	}

	REP(q, query) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		c--;
		d--;
		int hoge = lca(c, d);
		queries[hoge].push_back(make_tuple(q, a, b, -2));
		queries[c].push_back(make_tuple(q, a, b, 1));
		queries[d].push_back(make_tuple(q, a, b, 1));
	}
	re_dfs(0, -1);
	REP(i, query) {
		cout << final_ans[i] << endl;
	}
}

Measured memory_bytes: 67568