#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

struct HLD {
    const int n;
    vector<vector<int>> g;
    vector<int> in, out, size, head, par;
    int it;
    void erase_par(int v, int prev) {
        par[v] = prev;
        for (auto& u : g[v]) {
            if (u == g[v].back()) break;
            if (u == prev) swap(u, g[v].back());
            erase_par(u, v);
        }
        g[v].pop_back();
    }
    void dfs1(int v) {
        for (auto& u : g[v]) {
            dfs1(u);
            size[v] += size[u];
            if (size[u] > size[g[v][0]]) swap(u, g[v][0]);
        }
    }
    void dfs2(int v) {
        in[v] = it++;
        for (auto u : g[v]) {
            head[u] = (u == g[v][0] ? head[v] : u);
            dfs2(u);
        }
        out[v] = it;
    }
public:
    HLD(int n_)
        : n(n_), g(n), in(n, -1), out(n, -1), size(n, 1), head(n), par(n, -1), it(0) {}
    HLD(const vector<vector<int>>& G)
        : n(G.size()), g(G), in(n, -1), out(n, -1), size(n, 1), head(n), par(n, -1), it(0) {}
    void add_edge(int u, int v) {
        g[u].push_back(v);
        g[v].push_back(u);
    }
    void build(int rt = 0) {
        for (auto v : g[rt]) erase_par(v, rt);
        dfs1(rt);
        head[rt] = rt;
        dfs2(rt);
    }
    int get_id(int v) {
        return in[v];
    }
    int get_lca(int u, int v) {
        while (true) {
            if (in[u] > in[v]) swap(u, v);
            if (head[u] == head[v]) return u;
            v = par[head[v]];
        }
    }
    void path_query(int u, int v, function<void(int, int)> f) {
        while (true) {
            if (in[u] > in[v]) swap(u, v);
            f(max(in[head[v]], in[u]), in[v] + 1);
            if (head[u] == head[v]) return;
            v = par[head[v]];
        }
    }
	void path_edge_query(int u, int v, function<void(int, int)> f) { //not verified!!
		while(true) {
			if(in[u]>in[v]) swap(u,v);
			if(head[u]!=head[v]){
				f(in[head[v]], in[v] + 1);
				v=par[head[v]];
			}
			else{
				if(u!=v) f(in[u]+1,in[v] + 1);
				break;
			}
		}
	}
    void subtree_query(int v, function<void(int, int)> f) {
        f(in[v], out[v]);
    }
    void subtree_edge_query(int v, function<void(int, int)> f) { //not verified!!
        f(in[v] + 1, out[v]);
    }
};

struct BIT { //0-origin!!! update and get just like lazy_segtree
	int n; vl bit0, bit1;
	void init(int mx) {
		n = mx;
		bit0 = vl(n + 1, 0); bit1 = vl(n + 1, 0);
	}
	BIT(int mx = 0) { init(mx); } 

	ll ga(vl& bit, int i) {
		ll s = 0;
		while(i > 0) { s += bit[i]; i -= i & -i; }
		return s;
	}
	void app(vl& bit, int i, ll x) {
		while(i <= n) { bit[i] += x; i += i & -i; }
	}
	void update(int a, int b, ll x) { //[a, b)
		a++;
		app(bit0, a, -x * (a - 1));
		app(bit1, a, x);
		app(bit0, b + 1, x * b);
		app(bit1, b + 1, -x);
	}
	ll get(int a, int b) { //[a, b)
		a++;
		return (ga(bit1, b) * b + ga(bit0, b)) 
			- (ga(bit1, a - 1) * (a - 1) + ga(bit0, a - 1));
	}
};

typedef pair<pi, int> ppi;
typedef pair<pi, pi> pppi;

int N, Q;
vector<ppi> G[MAX_N];
vector<pppi> query[MAX_N]; //u, v, dist, idx
ll ans[MAX_N][3];

void solve() {
	cin >> N >> Q;
	HLD hld(N);
	BIT bit(N);
	rep(i, 0, N - 1) {
		int a, b, c, d; cin >> a >> b >> c >> d; a--; b--; c--;
		hld.add_edge(a, b);
		G[c].pb(make_pair(pi(a, b), d));
	}
	rep(i, 0, Q) {
		int a, b, c, d;
		cin >> c >> d >> a >> b;
		a--; b--; c--;
		query[c].pb(make_pair(pi(a, b), pi(d, i)));
	}
	hld.build();

	ll updv;
	auto upd = [&](int l, int r) { bit.update(l, r, updv);};
	ll sum;
	auto get = [&](int l, int r) { sum += bit.get(l, r);};

	rep(i, 0, N) {
		rep(j, 0, sz(G[i])) {
			updv = G[i][j].sec;
			pi p = G[i][j].fst;
			hld.path_edge_query(p.fst, p.sec, upd);
		}
	}
	// rep(i, 0, N) {
	// 	rep(j, i + 1, N) {
	// 		sum = 0;
	// 		hld.path_edge_query(i, j, get);
	// 		// debug(i, j, sum);
	// 	}
	// }

	rep(i, 0, N) {
		rep(j, 0, sz(G[i])) {
			updv = -G[i][j].sec;
			pi p = G[i][j].fst;
			hld.path_edge_query(p.fst, p.sec, upd);
		}
		rep(j, 0, sz(query[i])) {
			sum = 0;
			pi p = query[i][j].fst;
			pi q = query[i][j].sec;
			hld.path_edge_query(p.fst, p.sec, get);
			ans[q.sec][0] = sum;
		}
		rep(j, 0, sz(G[i])) {
			updv = 1;
			pi p = G[i][j].fst;
			hld.path_edge_query(p.fst, p.sec, upd);
		}
		rep(j, 0, sz(query[i])) {
			sum = 0;
			pi p = query[i][j].fst;
			pi q = query[i][j].sec;
			hld.path_edge_query(p.fst, p.sec, get);
			ans[q.sec][1] = sum;
		}

		rep(j, 0, sz(query[i])) {
			sum = 0;
			pi q = query[i][j].sec;
			ans[q.sec][2] = q.fst;
		}
		rep(j, 0, sz(G[i])) {
			updv = G[i][j].sec - 1;
			pi p = G[i][j].fst;
			hld.path_edge_query(p.fst, p.sec, upd);
		}
	}
	rep(i, 0, Q) {
		// debug(ans[i][0], ans[i][1], ans[i][2]);
		cout << (ans[i][1] - ans[i][0]) * ans[i][2] + ans[i][0] << "\n";
	}
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 46132