#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
typedef pair<pi,pi> pipi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 100001
#define INF 1e9
int N,Q,a,b,c,d;

vi adj[maxn];

int p[maxn],heavy[maxn],depth[maxn],pos[maxn],head[maxn];


struct fenwick{
	int fw[maxn];
	void upd(int p,int v){ //update position p by +=v
		for (int i=p; i<=N; i+= (i&(-i))){
			fw[i] += v;
		}
	}

	int qry(int p){ //query from 1 to p
		int ans = 0;
		for (int i = p; i>0; i -= (i&(-i))){
			ans += fw[i];
		}
		return ans;
	}
}*fw;



int hld(int x,int pp){
	p[x] = pp;
	int size=1,max_child = -1, max_size = -1;
	
	aFOR(i,adj[x]){
		if (i != pp){
			depth[i] = depth[x] + 1;
			int sz = hld(i,x);
			
			
			size += sz;
			if (sz > max_size){
				max_size = sz;
				max_child = i;
			}
		}
	}
	heavy[x] = max_child;
	return size;
}

int cur = 1;

void decompose(int x,int h){
	head[x] = h; pos[x] = cur++;
	if (heavy[x] != -1) decompose(heavy[x],h);
	
	aFOR(i,adj[x]){
		if (i != heavy[x] && i != p[x]) decompose(i,i);
	}
}


vector <pipi> edges;
vpi colour[maxn];
vi ss[maxn];

pi qry(int x,int y,int c){
	int ans = 0;
	int num = 0;
	while (head[x] != head[y]){
		if (depth[head[x]] > depth[head[y]]) swap(x,y);
		
		ans += fw->qry(pos[y]) - fw->qry(pos[head[y]]-1);
		

		int lower = lower_bound(all(colour[c]),pi(pos[head[y]],-1)) - colour[c].begin();
		int upper = upper_bound(all(colour[c]),pi(pos[y],INF)) - colour[c].begin() - 1;
		
		//cout<<lower<<' '<<upper<<'\n';
		if (lower <= upper && lower != colour[c].size()){
			num += upper-lower+1;
			if (lower == 0) ans -= ss[c][upper];
			else ans -= ss[c][upper] - ss[c][lower-1];
		}
		
  		y = p[head[y]];
	}
	
	if (x == y) return pi(ans,num);
	if (depth[x] > depth[y]) swap(x,y);
	
	
	ans += fw->qry(pos[y]) - fw->qry(pos[x]);
	//cout<<pos[x]+1<<' '<<pos[y]-1<<'\n';
	int lower = lower_bound(all(colour[c]),pi(pos[x]+1,-1)) - colour[c].begin();
	int upper = upper_bound(all(colour[c]),pi(pos[y],INF)) - colour[c].begin() - 1;
	
	//cout<<lower<<' '<<upper<<'\n';
	if (lower <= upper && lower != colour[c].size()){
		num += upper-lower+1;
		if (lower == 0){
			//cout<<ans<<' ';
			ans -= ss[c][upper];
		}
		else ans -= ss[c][upper] - ss[c][lower-1];
	}
	return pi(ans,num);
}

int main(){
	fast;
	
	cin>>N>>Q;
	
	FOR(i,0,N-2){
		cin>>a>>b>>c>>d;
		edges.pb(pipi(pi(a,b),pi(c,d)));
		adj[a].pb(b); adj[b].pb(a);
	}
	
	mem(heavy,-1);
	hld(1,-1);
	decompose(1,-1);

	fw = new fenwick();
	

	aFOR(i,edges){
		int a = i.f.f, b = i.f.s, c = i.s.f, d = i.s.s;
		
		if (depth[a] > depth[b]) swap(a,b); //a is the parent
		
		colour[c].pb(pi(pos[b],d));

		fw->upd(pos[b],d);
	}

	
	FOR(i,1,N) sort(all(colour[i]));
	
	FOR(i,1,N){
		FOR(j,0,colour[i].size()-1){
			if (j == 0) ss[i].pb(colour[i][j].s);
			else ss[i].pb(colour[i][j].s+ss[i][j-1]);
		}
	}
	


	int x,y,u,v;
	
	FOR(i,0,Q-1){
		cin>>x>>y>>u>>v;
		
		pi ans = qry(u,v,x);
		cout<<ans.f + y * ans.s<<'\n';
	}

		
		
		
	
	
}



Measured memory_bytes: 26092