#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using dd = double;
using vdd = std::vector<dd>;
using vvdd = std::vector<vdd>;
using vvvdd = std::vector<vvdd>;

constexpr ll INF = 1LL << 60;
constexpr dd EPS = 1e-11;

//cin,cout高速化のおまじない＋桁数指定
struct Fast{
	Fast(){
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast;

#define REPS(i, S, E) for (ll i = (S); i <= (E); i++)
#define REP(i, N) REPS(i, 0, N-1)
#define DEPS(i, S, E) for (ll i = (E); i >= (S); i--)
#define DEP(i, N) DEPS(i, 0, N-1)
#define EACH(e, v) for (auto&& e : v)

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
template<class T> inline T MaxE(vector<T>&v,ll S,ll E){T m=v[S]; REPS(i,S,E)chmax(m,v[i]); return m;}//v[S]～v[E]の最大値
template<class T> inline T MinE(vector<T>&v,ll S,ll E){T m=v[S]; REPS(i,S,E)chmin(m,v[i]); return m;}//v[S]～v[E]の最小値
template<class T> inline T MaxE(vector<T> &v, ll N) { return MaxE(v, 0, N - 1); } //先頭N個中の最大値
template<class T> inline T MinE(vector<T> &v, ll N) { return MinE(v, 0, N - 1); }
template<class T> inline T MaxE(vector<T> &v) { return MaxE(v, (ll)v.size()); }
template<class T> inline T MinE(vector<T> &v) { return MinE(v, (ll)v.size()); }
template<class T> inline ll MaxI(vector<T>&v,ll S,ll E){ll m=S; REPS(i,S,E){if(v[i]>v[m])m=i;} return m;}
template<class T> inline ll MinI(vector<T>&v,ll S,ll E){ll m=S; REPS(i,S,E){if(v[i]<v[m])m=i;} return m;}
template<class T> inline ll MaxI(vector<T> &v, ll N) { return MaxI(v, 0, N - 1); }
template<class T> inline ll MinI(vector<T> &v, ll N) { return MinI(v, 0, N - 1); }
template<class T> inline ll MaxI(vector<T> &v) { return MaxI(v, (ll)v.size()); }
template<class T> inline ll MinI(vector<T> &v) { return MinI(v, (ll)v.size()); }
template<class T> inline T Sum(vector<T> &v, ll S, ll E){ T s=v[S]; REPS(i, S+1, E)s+=v[i]; return s; }
template<class T> inline T Sum(vector<T> &v, ll N) { return Sum(v, 0, N - 1); }
template<class T> inline T Sum(vector<T> &v) { return Sum(v, v.size()); }
template<class T> inline T POW(T a, ll n){ T r=1; for (; n>0; n>>=1, a*=a){ if (n&1)r*=a; } return r; }
inline ll POW(int a, ll n){ return POW((ll)a, n); }
inline ll MSB(ll a){for(ll o=63,x=-1;;){ll m=(o+x)/2; if(a<(1LL<<m))o=m; else x=m; if(o-x==1)return x;}}
inline ll CEIL(ll a, ll b){ return (a+b-1)/b; }

template<class T=ll> inline vector<T> cinv(ll N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
template<class T=ll, class S=ll> inline vector<pair<T, S>> cinv2(ll N){
	vector<pair<T, S>> v(N); REP(i,N){cin>>v[i].first>>v[i].second;} return move(v); }
template<class T=ll,class S=ll,class R=ll> inline vector<tuple<T, S, R>> cinv3(ll N){
	vector<tuple<T,S,R>> v(N); REP(i,N){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);} return move(v);}
template<class T=ll,class S=ll,class R=ll,class Q=ll> inline vector<tuple<T,S,R,Q>> cinv4(ll N){
	vector<tuple<T,S,R,Q>> v(N); REP(i,N){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i])>>get<3>(v[i]);} return move(v);}
template<class T> inline void coutv(vector<T> &v, char deli=' '){
	ll N=(ll)v.size(); REP(i,N){cout << v[i] << ((i==N-1)?'\n':deli);} }


struct mll{
	static ll MOD;
	ll val;
	mll(ll v = 0): val(v % MOD){ if (val < 0) val += MOD; }
	mll operator - () const { return -val; }
	mll operator + (const mll &b) const { return val + b.val; }
	mll operator - (const mll &b) const { return val - b.val; }
	mll operator * (const mll &b) const { return val * b.val; }
	mll operator / (const mll &b) const { return mll(*this) /= b; }
	mll operator + (ll b) const { return *this + mll(b); }
	mll operator - (ll b) const { return *this - mll(b); }
	mll operator * (ll b) const { return *this * mll(b); }
	friend mll operator + (ll a, const mll &b) { return b + a; }
	friend mll operator - (ll a, const mll &b) { return -b + a; }
	friend mll operator * (ll a, const mll &b) { return b * a; }
	mll &operator += (const mll &b) { val=(val+b.val)%MOD; return *this; }
	mll &operator -= (const mll &b) { val=(val+MOD-b.val)%MOD; return *this; }
	mll &operator *= (const mll &b) { val=(val*b.val)%MOD; return *this; }
	mll &operator /= (const mll &b) {
		ll c=b.val, d=MOD, u=1, v=0;
		while (d){
			ll t = c / d;
			c -= t * d; swap(c, d);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	mll &operator += (ll b) { return *this += mll(b); }
	mll &operator -= (ll b) { return *this -= mll(b); }
	mll &operator *= (ll b) { return *this *= mll(b); }
	mll &operator /= (ll b) { return *this /= mll(b); }
	bool operator == (const mll &b) { return val == b.val; }
	bool operator != (const mll &b) { return val != b.val; }
	bool operator == (ll b) { return *this == mll(b); }
	bool operator != (ll b) { return *this != mll(b); }
	friend bool operator == (ll a, const mll &b) { return mll(a) == b.val; }
	friend bool operator != (ll a, const mll &b) { return mll(a) != b.val; }
	friend ostream &operator << (ostream &os, const mll &a) { return os << a.val; }
	friend istream &operator >> (istream &is, mll &a) { return is >> a.val; }
	static mll Combination(ll a, ll b){
		chmin(b, a-b);
		if (b<0) return mll(0);
		mll c = 1;
		REP(i, b) c *= a-i;
		REP(i, b) c /= i+1;
		return c;
	}
};
ll mll::MOD = 998244353LL;// (ll)(1e9 + 7);

template<class T=ll, class S=ll> vector<vector<tuple<ll, T, S>>> in_GraphWeighted2(
	ll nodeNum, ll edgeNum, bool isDirected){
	vector<vector<tuple<ll, T, S>>> to(nodeNum);
	REP(i, edgeNum){
		ll v, u;
		T c;
		S d;
		cin >> v >> u >> c >> d;
		v--; u--;
		c--;
		to[v].emplace_back(u, c, d);
		if (!isDirected) to[u].emplace_back(v, c, d);
	}
	return std::move(to);
}

class Dubling{
private:
	vvll next;
	ll N, B;
	ll next_(ll v, ll i){ return (v<0) ? -1 : next[v][i]; }
public:
	Dubling(): N(0), B(0) {}
	Dubling(vll &nxt, ll nextTimesMax){ Init(nxt, nextTimesMax); }
	void Init(vll &nxt, ll nextTimesMax){
		N = (ll)nxt.size();
		B = MSB(nextTimesMax) + 1;
		next.resize(N, vll(B, -1));
		REP(v, N) next[v][0] = nxt[v];
		REPS(i, 1, B-1) REP(v, N) next[v][i] = next_(next_(v, i-1), i-1);
	}
	ll Times(ll v, ll times){ //!< times個先  times=0も可
		DEPS(i, 0, MSB(times))  if ((times>>i)&1) v = next_(v, i);
		return v;
	}
	ll TimesPow2(ll v, ll i) { return next[v][i]; }  //!< 2^i個先
};


ll N, Q;
vll parentAry;
Dubling parDbl;
vector<vector<tuple<ll, ll, ll>>> G;
ll B;
vll dep;

void dfs(ll v, ll p){
	parentAry[v] = p;

	EACH(e, G[v]){
		ll u = get<0>(e);
		if (u == p) continue;
		dfs(u, v);
	}
}

void dfsD(ll v, ll p){
	if (p == -1) dep[v] = 0;
	else dep[v] = dep[p]+1;

	EACH(e, G[v]){
		ll u = get<0>(e);
		if (u == p) continue;
		dfsD(u, v);
	}
}


//ダブリングを使って共通の親を求める
ll LCA(ll v, ll u, Dubling &parentDbl, vll &depth){
	if (depth[v] < depth[u]) swap(v, u);
	ll d = depth[u];
	v = parentDbl.Times(v, depth[v]-d);
	if (v == u) return v;
	//2^i個上の親が一致→移動しない、不一致→uもvも2^i個上に移動
	for (ll i=MSB(d); i>=0; i--){
		ll vv = parentDbl.TimesPow2(v, i), uu = parentDbl.TimesPow2(u, i);
		if (vv != uu) { v = vv; u = uu; }
	}
	return parentDbl.TimesPow2(v, 0);
}


vll oid;
vll st;
vvll oidc;
vvll oinc;
vvll oixc;

ll dfsoIdx;

void dfsO(ll v, ll p){
	EACH(e, G[v]){
		ll u = get<0>(e);
		ll c = get<1>(e);
		ll d = get<2>(e);
		if (u == p) continue;

		//入り
		st[u] = dfsoIdx;
		oid[dfsoIdx] = d;
		oidc[c].push_back(d);
		oinc[c].push_back(1);
		oixc[c].push_back(dfsoIdx);
		dfsoIdx++;

		dfsO(u, v);

		//出
		oid[dfsoIdx] = -d;
		oidc[c].push_back(-d);
		oinc[c].push_back(-1);
		oixc[c].push_back(dfsoIdx);
		dfsoIdx++;
	}
}

ll dist(ll v){
	ll oIdx = st[v];
	return oid[oIdx];
}
ll cdist(ll c, ll v){
	ll oIdx = st[v];
	ll cIdx = upper_bound(oixc[c].begin(), oixc[c].end(), oIdx)
		- oixc[c].begin() - 1;
	return oidc[c][cIdx];
}
ll cnum(ll c, ll v){
	ll oIdx = st[v];
	ll cIdx = upper_bound(oixc[c].begin(), oixc[c].end(), oIdx)
		- oixc[c].begin() - 1;
	return oinc[c][cIdx];
}



void solve()
{
	cin >> N >> Q;
	G = in_GraphWeighted2<>(N, N-1, false);
	parentAry.resize(N);
	dep.resize(N);
	oid.resize(2*N-1);
	//oin.resize(2*N-1);
	st.resize(N, -1);
	oidc.resize(N-1);
	oinc.resize(N-1);
	oixc.resize(N-1);


	auto xyuv = cinv4(Q);
	EACH(e, xyuv){
		get<0>(e)--;
		get<2>(e)--;
		get<3>(e)--;
	}

	//0をrootにした時の親を得る(parentAry)
	dfs(0, -1);

	//ダブリング準備
	parDbl.Init(parentAry, N-1);
	
	//depth計算
	dfsD(0, -1);

	//オイラーツアーで各種データ準備
	st[0] = 0;
	oid[0] = 0;
	dfsoIdx = 1;
	EACH(e, oidc) e.push_back(0);
	EACH(e, oinc) e.push_back(0);
	EACH(e, oixc) e.push_back(0);
	dfsO(0, -1);
	//累積和に変換
	REPS(i, 1, (ll)oid.size()-1) oid[i] += oid[i-1];
	REP(c, N-1){
		REPS(i, 1, (ll)oidc[c].size()-1){
			oidc[c][i] += oidc[c][i-1];
		}
		REPS(i, 1, (ll)oinc[c].size()-1){
			oinc[c][i] += oinc[c][i-1];
		}
	}


	EACH(e, xyuv){
		ll x = get<0>(e);
		ll y = get<1>(e);
		ll u = get<2>(e);
		ll v = get<3>(e);
		ll lca = LCA(u, v, parDbl, dep);
		
		ll ans = dist(u) + dist(v) - 2*dist(lca)
			- (cdist(x, u)+cdist(x, v)-2*cdist(x, lca))
			+ (cnum(x, u) +cnum(x, v) -2*cnum(x, lca))*y;
		cout << ans << '\n';
	}
}

int main(){
	solve();
	return 0;
}


Measured memory_bytes: 62304