// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

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

typedef long long LL;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef long double ld;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define ui(n) ((unsigned int)(n))
#define LL(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define ld(n) ((long double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const LL LINF=4557430888798830399;
const ld eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define rep1(i,n) for(int i=1;i<=((int)(n));i++)
#define repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

inline int Read(){int x=0,w=0;char ch=0;while(!isdigit(ch)){w|=ch=='-';ch=getchar();}while(isdigit(ch))x=(x<<3)+(x<<1)+
(ch^48),ch=getchar();return w?-x:x;}
inline void Write(int x){if(x<0)putchar('-'),x=-x;if(x>9)Write(x/10);putchar(x%10+'0');}
inline LL powmod(LL a,LL b){LL res=1;a%=MOD;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res%MOD;}
inline LL gcdll(LL a,LL b){return b?gcdll(b,a%b):a;}

const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={1,0,-1,0,-1,-1,1,1};
/*********************************************************BEGIN*********************************************************/
const int maxn=100010;

struct edge
{
	int v,col,len;

	edge(int _v,int _col,int _len):v(_v),col(_col),len(_len) {}
};

struct modify
{
	int idx,typ,col,mul;

	modify(int _idx,int _typ,int _col,int _mul):idx(_idx),typ(_typ),col(_col),mul(_mul) {}
};

int n,q,dep[maxn],par[maxn][20];
vector<edge> e[maxn];
vector<modify> m[maxn];
LL ans[maxn],cnt[maxn],sum[maxn];

inline void dfs1(int u,int f)
{
	dep[u]=dep[f]+1;
	par[u][0]=f;
	for(int i=1;i<20;i++) par[u][i]=par[par[u][i-1]][i-1];

	repV(i,e[u])
	{
		int v=i.v;
		if(v!=f) dfs1(v,u);
	}
}

inline void dfs2(int u,int f,LL d)
{
	repV(i,m[u])
	{
		int idx=i.idx,typ=i.typ,col=i.col,mul=i.mul;

		if(typ==1)
		{
			ans[idx]+=d*mul;
		}
		else if(typ==2)
		{
			ans[idx]+=sum[col]*mul;
		}
		else
		{
			ans[idx]+=cnt[col]*mul;
		}
	}

	repV(i,e[u])
	{
		int v=i.v,col=i.col,len=i.len;
		if(v==f) continue;

		sum[col]+=len;
		cnt[col]++;

		dfs2(v,u,d+len);

		sum[col]-=len;
		cnt[col]--;
	}
}

inline int lca(int u,int v)
{
	if(dep[u]<dep[v]) swap(u,v);
	for(int i=0;dep[u]>dep[v];i++) if((dep[u]-dep[v])&(1<<i)) u=par[u][i];
	if(u==v) return u;
	
	for(int i=19;i>=0;i--) if(par[u][i]!=par[v][i]) u=par[u][i],v=par[v][i];
	
	return par[u][0];
}

int main()
{
	SF("%d%d",&n,&q);
	for(int i=0;i<n-1;i++)
	{
		int u,v,col,len;SF("%d%d%d%d",&u,&v,&col,&len);
		e[u].push_back(edge(v,col,len));
		e[v].push_back(edge(u,col,len));
	}

	dfs1(1,0);

	for(int i=1;i<=q;i++)
	{
		int c,l,u,v;SF("%d%d%d%d",&c,&l,&u,&v);
		int w=lca(u,v);

		m[u].push_back(modify(i,1,0,1));
		m[u].push_back(modify(i,2,c,-1));
		m[u].push_back(modify(i,3,c,l));

		m[v].push_back(modify(i,1,0,1));
		m[v].push_back(modify(i,2,c,-1));
		m[v].push_back(modify(i,3,c,l));

		m[w].push_back(modify(i,1,0,-2));
		m[w].push_back(modify(i,2,c,2));
		m[w].push_back(modify(i,3,c,-2*l));
	}

	dfs2(1,0,0);

	for(int i=1;i<=q;i++) PF("%lld\n",ans[i]);

	return 0;
}
/**********************************************************END**********************************************************/

Measured memory_bytes: 48068