Problem: There is a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively. Here the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and different integers correspond to different colors.

Answer the following Q queries:

* Query j (1 \leq j \leq Q): assuming that the length of every edge whose color is x_j is changed to y_j, find the distance between Vertex u_j and Vertex v_j. (The changes of the lengths of edges do not affect the subsequent queries.)

Constraints

* 2 \leq N \leq 10^5
* 1 \leq Q \leq 10^5
* 1 \leq a_i, b_i \leq N
* 1 \leq c_i \leq N-1
* 1 \leq d_i \leq 10^4
* 1 \leq x_j \leq N-1
* 1 \leq y_j \leq 10^4
* 1 \leq u_j < v_j \leq N
* The given graph is a tree.
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N Q
a_1 b_1 c_1 d_1
:
a_{N-1} b_{N-1} c_{N-1} d_{N-1}
x_1 y_1 u_1 v_1
:
x_Q y_Q u_Q v_Q


Output

Print Q lines. The j-th line (1 \leq j \leq Q) should contain the answer to Query j.

Example

Input

5 3
1 2 1 10
1 3 2 20
2 4 4 30
5 2 1 40
1 100 1 4
1 100 1 5
3 1000 3 4


Output

130
200
60

Solution (in CPP):

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


typedef long long ll;
#define reg register
#define rep(a,b,c) for(reg int a=b,a##end=c;a<=a##end;++a)
#define drep(a,b,c) for(reg int a=b,a##end=c;a>=a##end;--a)

char IO;
int rd(){
	int s=0,f=0;
	while(IO=getchar(),IO<'0'||IO>'9')if(IO=='-')f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(IO=getchar(),IO>='0'&&IO<='9');
	return f?-s:s;
}


const int N=2e5+10,K=30;

int n,m;



struct Edge{
	int to,nxt,col,len;
}e[N<<1];
int head[N],ecnt;
void AddEdge(int u,int v,int x,int y){
	e[++ecnt]=(Edge){v,head[u],x,y};
	head[u]=ecnt;
}
#define erep(u,i) for(int i=head[u];i;i=e[i].nxt)

int fa[N][21];
ll dis[N];
int ls[N*K],rs[N*K];
struct node{
	ll s;
	ll sum;
}tr[N*K];
int T[N],cnt;

void Add(int p,int pre,int x,int y,int l=1,int r=n){
	tr[p].s=tr[pre].s+1,tr[p].sum=tr[pre].sum+y;
	if(l==r) return;
	int mid=(l+r)>>1;
	if(x<=mid) rs[p]=rs[pre],Add(ls[p]=++cnt,ls[pre],x,y,l,mid);
	else ls[p]=ls[pre],Add(rs[p]=++cnt,rs[pre],x,y,mid+1,r);
}

node Que(int p,int l,int r,int x){
	if(l==r) return tr[p];
	int mid=(l+r)>>1;
	if(x<=mid) return Que(ls[p],l,mid,x);
	else return Que(rs[p],mid+1,r,x);
}

int dep[N];

int LCA(int x,int y){
	if(dep[x]<dep[y]) swap(x,y);
	for(int i=0,del=dep[x]-dep[y];(1<<i)<=del;i++) if(del&(1<<i)) x=fa[x][i];
	if(x==y) return x;
	drep(i,20,0) if(dep[x]>=(1<<i)){
		if(fa[x][i]!=fa[y][i]){
			x=fa[x][i],y=fa[y][i];
		}
	}
	return fa[x][0];
}

void dfs(int u,int f){
	fa[u][0]=f;
	for(int i=1;(1<<i)<=dep[u];i++) fa[u][i]=fa[fa[u][i-1]][i-1];
	erep(u,i){
		int v=e[i].to;
		if(v==f) continue;
		dis[v]=dis[u]+e[i].len;
		Add(T[v]=++cnt,T[u],e[i].col,e[i].len);
		dep[v]=dep[u]+1;
		dfs(v,u);
	}
}




int main(){
	n=rd(),m=rd();
	rep(i,2,n) {
		int u=rd(),v=rd(),c=rd(),d=rd();
		AddEdge(u,v,c,d);AddEdge(v,u,c,d);
	}
	dfs(1,0);
	//cout<<LCA(2,3)<<endl;
	rep(i,1,m){
		int x=rd(),y=rd(),u=rd(),v=rd();
		int lca=LCA(u,v);
		node a=Que(T[u],1,n,x),b=Que(T[v],1,n,x),c=Que(T[lca],1,n,x);
		ll cnt=a.s+b.s-c.s*2;
		ll sum=a.sum+b.sum-2*c.sum;
		ll ans=dis[u]+dis[v]-2*dis[lca];
		ans-=sum;
		ans+=1ll*y*cnt;
		printf("%lld\n",ans);
	}
}