#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
using namespace std;


#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


//つよいせぐつりー！
struct LazySegTree { //参照は i + sz - 1 だよ～;
	ll sz;
	vector<ll> node, lazy;
	vector<bool> lazyFlag;
	LazySegTree(ll n) {
		sz = 1;
		while (sz < n) sz *= 2;
		node.resize(2 * sz - 1);//
		lazy.resize(2 * sz - 1);//
		lazyFlag.resize(2 * sz - 1);
	}
	void eval(ll k, ll l, ll r) {
		if (lazyFlag[k]) {
			node[k] = lazy[k];//
			if (r - l > 1) {
				lazy[2 * k + 1] = lazy[k];//
				lazy[2 * k + 2] = lazy[k];//
				lazyFlag[2 * k + 1] = lazyFlag[2 * k + 2] = true;
			}
			lazyFlag[k] = false;
			lazy[k] = 0;//
		}
	}
	void update(ll a, ll b, ll x, ll k = 0, ll l = 0, ll r = -1) {
		if (r < 0) r = sz;
		eval(k, l, r);
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			lazy[k] = x;//
			lazyFlag[k] = true;
			eval(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] = node[2 * k + 1] + node[2 * k + 2];//
		}
	}
	void update(ll a, ll x) {
		update(a, a + 1, x);
	}
	ll query(ll a, ll b, ll k = 0, ll l = 0, ll r = -1) {
		if (r < 0) r = sz;
		eval(k, l, r);
		if (b <= l || r <= a) return 0;//
		if (a <= l && r <= b) return node[k];
		ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
		ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
		return vl + vr;//
	}
	void init() {
		REPR(i, sz - 2) node[i] = node[2 * i + 1] + node[2 * i + 2];//
	}
};

struct HLD {//いつもの
	vector<ll> g[510000];
	vector<ll> sz, in, out, head, rev, par, dep; //rev = in -> index
	HLD(ll n) : sz(n), in(n), out(n), head(n), rev(n), par(n), dep(n) {};
	void dfs_sz(ll a, ll p, ll b) {
		par[a] = p;
		sz[a] = 1;
		dep[a] = b;
		if (g[a].size() && g[a][0] == p) swap(g[a][0], g[a].back());
		for (auto& to : g[a]) {
			if (to == p)continue;
			dfs_sz(to, a, b + 1);
			sz[a] += sz[to];
			if (sz[g[a][0]] < sz[to])swap(g[a][0], to);
		}
	}
	void dfs_hld(ll a, ll p, ll& t) {
		in[a] = t++;
		rev[in[a]] = a;
		for (auto& to : g[a]) {
			if (to == p)continue;
			head[to] = (g[a][0] == to ? head[a] : to);
			dfs_hld(to, a, t);
		}
		out[a] = t;
	}
	void edgeset(ll a, ll b) {
		g[a].push_back(b);
		g[b].push_back(a);
	}
	void build() {
		dfs_sz(0, -1, 0);
		ll t = 0;
		dfs_hld(0, -1, t);
	}
	void input(ll n) {
		REP(i, n - 1) {
			ll a, b;
			cin >> a >> b;
			a--; b--;
			edgeset(a, b);
		}
		build();
	}
	ll la(ll a, ll x) {
		while (1) {
			ll h = head[a];
			if (in[a] - x >= in[h])return rev[in[a] - x];
			x -= in[a] - in[h] + 1;
			a = par[h];
		}
	}
	ll lca(ll a, ll b) {
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b);
			if (head[a] == head[b])return a;
		}
	}
	template< typename Q, typename F >
	ll query(ll a, ll b, ll ti, const Q& q, const F& f, bool edge = false) {
		ll l = ti, r = ti;
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b), swap(l, r);
			if (head[a] == head[b])break;
			l = f(q(in[head[b]], in[b] + 1), l);
		}
		return f(f(q(in[a] + edge, in[b] + 1), l), r);
	}
	template < typename Q >
	void addpath(ll a, ll b, ll x, const Q& q, bool edge = false) { //path
		for (;; b = par[head[b]]) {
			if (in[a] > in[b])swap(a, b);
			if (head[a] == head[b])break;
			q(in[head[b]], in[b] + 1, x);
		}
		return q(in[a] + edge, in[b] + 1, x);
	}
	template < typename Q >
	void addst(ll a, ll x, const Q& q) { //subtree
		q(in[a], out[a], x);
	}
};

ll n, q;
#define PP pair<ll, P>
vector<PP> cp[100010];
vector<ll> cv[100010];
int main() {
	cin >> n >> q;
	vector<ll> a(n), b(n), c(n), d(n), x(q), y(q), u(q), v(q), ans(q);
	LazySegTree seg(410000), num(410000);
	HLD tree(n);
	REP(i, n - 1) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--;
		b[i]--;
		tree.edgeset(a[i], b[i]);
		cp[c[i]].push_back(PP(d[i], P(a[i], b[i])));
	}
	tree.build();
	REP(i, q) {
		cin >> x[i] >> y[i] >> u[i] >> v[i];
		u[i]--;
		v[i]--;
		cv[x[i]].push_back(i);
	}

	REPO(i, n - 1) {
		seg.update(0, 200010, 0);
		num.update(0, 200010, 0);
		REP(j, cp[i].size()) {
			PP now = cp[i][j];
			auto Q1 = [&](ll a, ll b, ll x) {seg.update(a, b, x); };
			auto Q2 = [&](ll a, ll b, ll x) {num.update(a, b, x); };
			ll nu = now.second.first, nv = now.second.second;
			tree.addpath(nu, nv, now.first, Q1, true);
			tree.addpath(nu, nv, 1, Q2, true);
		}
		REP(j, cv[i].size()) {
			ll now = cv[i][j];
			auto Q1 = [&](ll a, ll b) { return seg.query(a, b); };
			auto Q2 = [&](ll a, ll b) { return num.query(a, b); };
			auto F = [&](ll a, ll b) { return a + b; };
			ans[now] -= tree.query(u[now], v[now], 0, Q1, F, true);
			ans[now] += y[now] * tree.query(u[now], v[now], 0, Q2, F, true);
		}
	}
	seg.update(0, 100010, 0);
	auto Q1 = [&](ll a, ll b, ll x) {seg.update(a, b, x); };
	auto Q2 = [&](ll a, ll b) { return seg.query(a, b); };
	auto F = [&](ll a, ll b) { return a + b; };
	REP(i, n) tree.addpath(a[i], b[i], d[i], Q1, true);
	REP(i, q) {
		ans[i] += tree.query(u[i], v[i], 0, Q2, F, true);
		cout << ans[i] << endl;
	}
}



Measured memory_bytes: 74800