#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

template<typename T> class SegmentTree {
private:
	T * a = NULL;
	int N = -1, S;
	function<T(T, T)> F;
	T I;
	bool is_available = false;
public:
	SegmentTree() { }
	SegmentTree(int n, function<T(T, T)> func, T id) { init(n, func, id); }
	void init(int size, function<T(T, T)> func, T id) {
		assert(size > 0);
		N = size;
		F = func;
		I = id;
		S = 1;
		while(S < size) { S *= 2; }
		delete[] a;
		a = new T[S * 2];
		inc(i, S * 2) { a[i] = I; }
		is_available = true;
	}
	const T & operator[](int p) {
		assert(inID(p, 0, N));
		p += S;
		return a[p];
	}
	T & ref(int p) {
		is_available = false;
		assert(inID(p, 0, N));
		p += S;
		return a[p];
	}
	void calc() {
		decID(i, 1, S) { a[i] = F(a[i * 2], a[i * 2 + 1]); }
		is_available = true;
	}
	void apply(int p, function<void(T &)> op) {
		assert(inID(p, 0, N));
		p += S;
		op(a[p]);
		while(p != 1) {
			p /= 2;
			a[p] = F(a[p * 2], a[p * 2 + 1]);
		}
	}
	T fold_ID(int l, int r, bool loop = false) {
		assert(is_available);
		assert(inII(l, 0, N));
		assert(inII(r, 0, N));
		if(loop && l >= r) { return F(fold_ID(l, N), fold_ID(0, r)); }
		assert(l <= r);
		l += S;
		r += S;
		T v = I, w = I;
		while(l < r) {
			if(l + 1 == r) { v = F(v, a[l]); break; }
			if(l % 2 == 1) { v = F(v, a[l]); }
			if(r % 2 == 1) { w = F(a[r - 1], w); }
			l = (l + 1) / 2;
			r = r / 2;
		}
		return F(v, w);
	}
	T fold_II(int l, int r, bool loop = false) { return fold_ID(l    , r + 1, loop); }
	T fold_CD(int l, int r, bool loop = false) { return fold_ID(l + 1, r    , loop); }
	T fold_CI(int l, int r, bool loop = false) { return fold_ID(l + 1, r + 1, loop); }
};

#define OP(op) [&](auto A, auto B) { return op; }
#define AP(op) [&](auto & A) { op; }

// ---- ----

#define LB(v, x) distance(v.begin(), lower_bound(ALL(v), x))
#define UB(v, x) distance(v.begin(), upper_bound(ALL(v), x))

const int M = 100000;

int n, q, c[M], d[M];
vector<pair<int, int>> g[M];

vector<pair<int, int>> et_v, et_e; // v: { d, v }, e: { +/-, e }
void et(int v, int p, int d) {
	et_v.EB(d, v);
	RF(P, g[v]) {
		int w = P.FI;
		int e = P.SE;
		if(w == p) { continue; }
		
		et_e.EB(+1, e);
		et(w, v, d + 1);
		et_e.EB(-1, e);
		et_v.EB(d, v);
	}
}

int main() {
	cin >> n >> q;
	inc(i, n - 1) {
		int a, b;
		cin >> a >> b >> c[i] >> d[i];
		a--; b--;
		g[a].EB(b, i);
		g[b].EB(a, i);
	}
	
	et(0, -1, 0);
	
	vector<int> pos(n);
	SegmentTree<pair<int, int>> st(SI(et_v), OP(min(A, B)), { n, -1 });
	inc(i, SI(et_v)) {
		pos[et_v[i].SE] = i;
		st.ref(i) = et_v[i];
	}
	st.calc();
	
	vector<vector<int>> id(n), cn(n, { 0 }), cs(n, { 0 });
	inc(i, SI(et_e)) {
		int s = et_e[i].FI;
		int e = et_e[i].SE;
		id[c[e]].PB(i);
		cn[c[e]].PB(s);
		cs[c[e]].PB(s * d[e]);
		id[0].PB(i);
		cs[0].PB(s * d[e]);
	}
	inc(i, n) {
		inc(j, SI(cn[i]) - 1) { cn[i][j + 1] += cn[i][j]; }
		inc(j, SI(cs[i]) - 1) { cs[i][j + 1] += cs[i][j]; }
	}
	
	inc(qq, q) {
		int x, y, v, w;
		cin >> x >> y >> v >> w;
		v--; w--;
		
		int l = pos[v];
		int r = pos[w];
		if(! (l < r)) { swap(l, r); }
		int m = pos[st.fold_II(l, r).SE];
		
		int al = LB(id[0], l);
		int ar = LB(id[0], r);
		int am = LB(id[0], m);
		int aS = cs[0][al] + cs[0][ar] - 2 * cs[0][am];
		
		int cl = LB(id[x], l);
		int cr = LB(id[x], r);
		int cm = LB(id[x], m);
		int cN = cn[x][cl] + cn[x][cr] - 2 * cn[x][cm];
		int cS = cs[x][cl] + cs[x][cr] - 2 * cs[x][cm];
		
		cout << aS - cS + y * cN << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 39572