#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
vector<long long> divisor(long long n) {
	vector< long long> ret;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}
struct LazySegmentTree {
private:
	int n;
	vector<int> node, lazy;
	vector<bool> lazyFlag;

public:
	LazySegmentTree(vector<int> v) {
		int sz = (int)v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1, INT_MAX);
		lazyFlag.resize(2 * n - 1, false);

		for (int i = 0; i<sz; i++) node[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
	}

	void lazyEvaluate(int k, int l, int r) {
		if (lazyFlag[k]) {
			node[k] = lazy[k];
			if (r - l > 1) {
				lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
				lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
			}
			lazyFlag[k] = false;
		}
	}

	void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			lazy[k] = x;
			lazyFlag[k] = true;
			lazyEvaluate(k, l, r);
		}
		else {
			update(a, b, x, 2 * k + 1, l, (l + r) / 2);
			update(a, b, x, 2 * k + 2, (l + r) / 2, r);
			node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		}
	}

	int find(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return INT_MAX;
		if (a <= l && r <= b) return node[k];
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};
#define ll long long
class UnionFind {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

					 // Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};
typedef pair<long long, long long>p;
long long mod = 1000000007;
int n, q;
typedef struct e{
	int to;
	int color;
	int dist;
}edge;
vector<edge>graph[100004];
int parent[20][100004];
p parentpath[100004];
int depth[100004];
int para = 334;
void dfs3(int v,int p,int d) {
	parent[0][v] = p;
	depth[v] = d;
	for (int i = 0; i < graph[v].size(); i++) {
		if (graph[v][i].to != p) {
			parentpath[graph[v][i].to] = pair<int,int>(graph[v][i].color,graph[v][i].dist);
			dfs3(graph[v][i].to, v, d + 1); }
	}
}
void init() {
	dfs3(1, -1, 0);
	for (int k = 0; k + 1 < 20; k++) {
		for (int v = 1; v <= n; 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 < 20; k++) {
		if ((depth[v] - depth[u]) >> k & 1) {
			v = parent[k][v];
		}
	}
	if (u == v)return u;
	for (int k = 19; k >= 0; k--) {
		if (parent[k][u] != parent[k][v]) {
			u = parent[k][u];
			v = parent[k][v];
		}
	}
	return parent[0][u];
}
map<int, int>ma;
int today = 1;
const int siz=500;
p cpath[siz][100004];
int dist[100004];
void dfs(int now) {
	if (depth[now] % para == 0 && depth[now] != 0) {
		ma[now] = today;
		int tmp = now;
		while (depth[tmp] != depth[now] - para) {
			cpath[today][parentpath[tmp].first].first += 1;
			cpath[today][parentpath[tmp].first].second+= parentpath[tmp].second;
			tmp = parent[0][tmp];
		}
		int index = ma.find(tmp)->second;
		for (int i = 1; i <= n; i++) {
			cpath[today][i].first += cpath[index][i].first;
			cpath[today][i].second += cpath[index][i].second;
		}
		today += 1;
	}
	for (int i = 0; i < graph[now].size(); i++) {
		if (graph[now][i].to != parent[0][now]) {
			dist[graph[now][i].to] = dist[now] + graph[now][i].dist;
			dfs(graph[now][i].to);
		}
	}
}
int calc(int x, int y, int node) {
	int ret = 0;
	while ((depth[node] % para) != 0) {
		if (parentpath[node].first == x)ret += y;
		else ret += parentpath[node].second;
		node = parent[0][node];
	}
	ret += dist[node];
	int index = ma.find(node)->second;
	ret += cpath[index][x].first*y - cpath[index][x].second;
	return ret;
}
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(16);
	for (int i = 0; i < siz; i++) {
		for (int j = 0; j < 100004; j++) {
			cpath[i][j] = p(0,0);
		}
	}
	cin >> n >> q;
	int a, b, c, d;
	for (int i = 0; i < n-1; i++) {
		cin >> a >> b >> c >> d;
		edge x{ b,c,d };
		graph[a].push_back(x);
		edge y{ a,c,d };
		graph[b].push_back(y);
	}
	init();
	dist[1] = 0;
	for (int i = 0; i <= n; i++) {
		cpath[0][i] = p(0, 0);
	}
	ma[1] = 0;
	dfs(1);
	int x, y, u, v;
	while (q--) {
		cin >> x >> y >> u >> v;
		int l = lca(u, v);
		long long uu = calc(x,y,u);
		long long vv = calc(x,y,v);
		long long l2 = calc(x,y,l);
		cout << uu - l2 + vv - l2<<"\n";
	}
}

Measured memory_bytes: 803456