/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *NOIP 2019 RP++                                           *
 ***********************************************************/
//#pragma GCC optimize(3)
#define ADD_STACK int size = 512 << 20;\
	char *pp = (char*)malloc(size) + size;  \
	__asm__("movl %0, %%esp\n" :: "r"(pp))
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<fstream>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#include<ctime>
#include<vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x,y) (((x)>(y))?(x):(y))
#define Min(x,y) (((x)<(y))?(x):(y))
#define Abs(x) (((x)<(0))?(-(x)):(x))
#define infll (ll)(1e18)
#define infint (1<<30)
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register int a=b;a<=c;++a)
#define FORD(a,b,c) for (register int a=b;a>=c;--a)
using namespace std;
//char buf[1<<20],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline ll read(){
	ll x=0,f=1;char c;
	for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
	for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());return x*f;
}
template<typename T>
inline void write(T a){
	if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
	while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
}
inline void write_(){return;}
template<typename T,typename... Args>
inline void write_(T a,Args... b){write(a);putchar(' ');write_(b...);}
inline void writeln(){putchar('\n');return;}
template<typename T,typename... Args>
inline void writeln(T a,Args... b){write(a);putchar(' ');writeln(b...);}
//need c++11

//inline void write(ll a){
//    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
//    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
//inline void write_(ll a){write(a);putchar(' ');}
//inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
inline ll lcm(ll a,ll b){return 1ll*a/gcd(a,b)*b;}
inline ll Pow(ll n,ll a){ll b=1;while(a){if(a&1)b=1ll*b*n%mod;n=1ll*n*n%mod;a>>=1;}return b;}
//---------------------Head Files--------------------------//
int in[mn],b[mn],f[mn][30],fir[mn],nxt[mn],y[mn],tot,de[mn],ti,num[mn],tot2,n2[mn],c[mn],z,a[mn],an[mn];
int clc[mn],cln[mn],sum;
inline void add(int x,int y1,int z,int dd){
	nxt[++tot]=fir[x];fir[x]=tot;y[tot]=y1;c[tot]=z;a[tot]=dd;
}
void dfs(int d,int x){
	in[x]=++ti;//de[x]=d;
	if(!num[x])num[x]=++tot2,n2[tot2]=x;
	b[ti]=num[x];
//	cout<<"**"<<num[x]<<' '<<ti<<endl;
	for(int i=fir[x];i;i=nxt[i])
		if(!in[y[i]]){
			dfs(d+1,y[i]);
			b[++ti]=num[x];//de[ti]=d;
//			cout<<"**"<<num[x]<<' '<<ti<<endl;
		}
	return;
}
inline int lca(int x,int y){
	x=in[x];y=in[y];
	if(x>y)swap(x,y);
	int k=trunc(log2(y-x+1));
	return n2[Min(f[x][k],f[y-(1<<k)+1][k])];
}
struct ask{
	int co,c,f,h;
}A;
vector<ask>v[mn];
inline void dfs2(int x,int fa){
	int sz=v[x].size();
	FOR(i,0,sz-1){
		A=v[x][i];
		an[A.h]+=A.f*(sum-clc[A.co]+cln[A.co]*A.c);
	}
	for(int i=fir[x];i;i=nxt[i])if(y[i]!=fa){
		clc[a[i]]+=c[i];cln[a[i]]++;sum+=c[i];
		dfs2(y[i],x);
		clc[a[i]]-=c[i];cln[a[i]]--;sum-=c[i];
	}
}
int main(){
	int n=read(),m=read(),s=1,x,y,z,dd;
	ti=tot=tot2=0;
	// FOR(i,1,m)fir[i]=-1;
	FOR(i,1,n-1)x=read(),y=read(),dd=read(),z=read(),add(x,y,z,dd),add(y,x,z,dd);
	dfs(1,s);
	FOR(i,1,ti)f[i][0]=b[i];
	for(int j=1;(1<<j)<=ti;j++)
		for(int i=1;i+(1<<j)-1<=ti;i++){
			f[i][j]=min(f[i][j-1],f[i+(1<<(j-1))][j-1]);
		}
	int lc;
	FOR(i,1,m){
		dd=read(),z=read(),x=read(),y=read();
		lc=lca(x,y);
		v[x].push_back((ask){dd,z,1,i});
		v[y].push_back((ask){dd,z,1,i});
		v[lc].push_back((ask){dd,z,-2,i});
	}
	dfs2(s,0);
	FOR(i,1,m)writeln(an[i]);
	return 0;
}

Measured memory_bytes: 48500