#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (1e10)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);}} premain;

struct HLDecomposition {
  int n,pos;
  vector<vector<int> > G;
  vector<int> vid, head, sub, hvy, par, dep, inv, type;
  
  HLDecomposition(){}
  HLDecomposition(int sz):
    n(sz),pos(0),G(n),
    vid(n,-1),head(n),sub(n,1),hvy(n,-1),
    par(n),dep(n),inv(n),type(n){}
  
  void add_edge(int u, int v) {
    G[u].push_back(v);
    G[v].push_back(u);
  }

  void build(vector<int> rs=vector<int>(1,0)) {
    int c=0;
    for(int r:rs){
      dfs(r);
      bfs(r, c++);
    }
  }
  
  void dfs(int rt) {
    using T = pair<int,int>;
    stack<T> st;
    par[rt]=-1;
    dep[rt]=0;
    st.emplace(rt,0);
    while(!st.empty()){
      int v=st.top().first;
      int &i=st.top().second;
      if(i<(int)G[v].size()){
	int u=G[v][i++];
	if(u==par[v]) continue;
	par[u]=v;
	dep[u]=dep[v]+1;
	st.emplace(u,0);
      }else{
	st.pop();
	int res=0;
	for(int u:G[v]){
	  if(u==par[v]) continue;
	  sub[v]+=sub[u];
	  if(res<sub[u]) res=sub[u],hvy[v]=u;
	}
      }
    }
  }

  void bfs(int r,int c) {
    int &k=pos;
    queue<int> q({r});
    while(!q.empty()){
      int h=q.front();q.pop();
      for(int i=h;i!=-1;i=hvy[i]) {
	type[i]=c;
	vid[i]=k++;
	inv[vid[i]]=i;
	head[i]=h;
	for(int j:G[i])
	  if(j!=par[i]&&j!=hvy[i]) q.push(j);
      }
    }
  }
  
  // for_each(vertex)
  // [l,r] <- attention!!
  void for_each(int u, int v, const function<void(int, int)>& f) {
    while(1){
      if(vid[u]>vid[v]) swap(u,v);
      f(max(vid[head[v]],vid[u]),vid[v]);
      if(head[u]!=head[v]) v=par[head[v]];
      else break;
    }
  }
  
  // for_each(edge)
  // [l,r] <- attention!!
  void for_each_edge(int u, int v, const function<void(int, int)>& f) {
    while(1){
      if(vid[u]>vid[v]) swap(u,v);
      if(head[u]!=head[v]){
	f(vid[head[v]],vid[v]);
        v=par[head[v]];
      } else{
	if(u!=v) f(vid[u]+1,vid[v]);
	break;
      }
    }
  }

  int lca(int u,int v){
    while(1){
      if(vid[u]>vid[v]) swap(u,v);
      if(head[u]==head[v]) return u;
      v=par[head[v]];
    }
  }

  int distance(int u,int v){
    return dep[u]+dep[v]-2*dep[lca(u,v)];
  }
};

#define N_MAX	(100100)
int N, Q;
vector<vector<int>> E[N_MAX];   // dst, color, distance
vector<vector<int>> Ques[N_MAX]; // id, color, new_distance, delta
ll ans[N_MAX] = {0};
ll color_total[N_MAX] = {0};
ll color_count[N_MAX] = {0};

void dfs(int cur, int par, ll sum) {
  for (auto &q : Ques[cur]) {
    int id = q[0];
    int color = q[1];
    int new_distance = q[2];
    int delta = q[3];
    ans[id] += (sum - color_total[color] + color_count[color] * new_distance) * delta;
  }
  
  for (auto &e : E[cur]) {
    int dst = e[0];
    int color = e[1];
    int distance = e[2];
    
    if (dst == par) {
      continue;
    }
    color_total[color] += (ll)distance;
    color_count[color]++;
    dfs(dst, cur, sum + distance);
    color_total[color] -= (ll)distance;
    color_count[color]--;
  }
}

int main() {
  cin >> N >> Q;
  
  HLDecomposition hld(N+10);
  //E.resize(N+10);
  //Ques.resize(N+10);
  //ans.resize(N+10);
  
  REP(i, N-1) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--;
    b--;
    E[a].push_back({b, c, d});
    E[b].push_back({a, c, d});
    
    hld.add_edge(a, b);
  }
  
  hld.build();
  
  REP(i, Q) {
    int x, y, u, v;
    cin >> x >> y >> u >> v;
    u--;
    v--;

    ans[i] = 0;
    Ques[u].push_back({i, x, y, 1});
    Ques[v].push_back({i, x, y, 1});
    Ques[hld.lca(u, v)].push_back({i, x, y, -2});
  }
  
  dfs(0, -1, 0);
  
  REP(i, Q) {
    print(ans[i]);
  }
}


Measured memory_bytes: 53628