#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct HLDecomposition {
  Int n,pos;
  vector<vector<Int> > G;
  vector<Int> vid, head, sub, par, dep, inv, type;

  HLDecomposition(){}
  HLDecomposition(Int n):
    n(n),pos(0),G(n),vid(n,-1),head(n),sub(n,1),
    par(n,-1),dep(n,0),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={0}) {
    Int c=0;
    for(Int r:rs){
      dfs_sz(r);
      head[r]=r;
      dfs_hld(r,c++);
    }
  }

  void dfs_sz(Int v) {
    for(Int &u:G[v]){
      if(u==par[v]) continue;
      par[u]=v;
      dep[u]=dep[v]+1;
      dfs_sz(u);
      sub[v]+=sub[u];
      if(sub[u]>sub[G[v][0]]) swap(u,G[v][0]);
    }
  }

  void dfs_hld(Int v,Int c) {
    vid[v]=pos++;
    inv[vid[v]]=v;
    type[v]=c;
    for(Int u:G[v]){
      if(u==par[v]) continue;
      head[u]=(u==G[v][0]?head[v]:u);
      dfs_hld(u,c);
    }
  }

  // for_each(vertex)
  // [l,r] <- attention!!
  template<typename F>
  void for_each(Int u, Int v, const F& 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;
    }
  }

  template<typename T,typename Q,typename F>
  T for_each(Int u,Int v,T ti,const Q &q,const F &f){
    T l=ti,r=ti;
    while(1){
      if(vid[u]>vid[v]){
        swap(u,v);
        swap(l,r);
      }
      l=f(l,q(max(vid[head[v]],vid[u]),vid[v]));
      if(head[u]!=head[v]) v=par[head[v]];
      else break;
    }
    return f(l,r);
  }

  // for_each(edge)
  // [l,r] <- attention!!
  template<typename F>
  void for_each_edge(Int u, Int v,const F& 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)];
  }
};


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


template <typename T>
struct SegmentTree{
  using F = function<T(T,T)>;
  Int n;
  F f;
  T ti;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(F f,T ti):f(f),ti(ti){}
  void init(Int n_){
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }
  void build(const vector<T> &v){
    Int n_=v.size();
    init(n_);
    for(Int i=0;i<n_;i++) dat[n+i]=v[i];
    for(Int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }
  void set_val(Int k,T x){
    dat[k+=n]=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
  }
  T query(Int a,Int b){
    T vl=ti,vr=ti;
    for(Int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[l++]);
      if(r&1) vr=f(dat[--r],vr);
    }
    return f(vl,vr);
  }
  template<typename C>
  Int find(Int st,C &check,T &acc,Int k,Int l,Int r){
    if(l+1==r){
      acc=f(acc,dat[k]);
      return check(acc)?k-n:-1;
    }
    Int m=(l+r)>>1;
    if(m<=st) return find(st,check,acc,(k<<1)|1,m,r);
    if(st<=l&&!check(f(acc,dat[k]))){
      acc=f(acc,dat[k]);
      return -1;
    }
    Int vl=find(st,check,acc,(k<<1)|0,l,m);
    if(~vl) return vl;
    return find(st,check,acc,(k<<1)|1,m,r);
  }
  template<typename C>
  Int find(Int st,C &check){
    T acc=ti;
    return find(st,check,acc,1,0,n);
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,q;
  cin>>n>>q;
  vector<Int> as(n),bs(n),cs(n),ds(n);
  vector<Int> xs(q),ys(q),us(q),vs(q);

  vector< vector<Int> > C(n),D(n);
  HLDecomposition hld(n);
  for(Int i=1;i<n;i++){
    cin>>as[i]>>bs[i]>>cs[i]>>ds[i];
    as[i]--;bs[i]--;
    hld.add_edge(as[i],bs[i]);
    C[cs[i]].emplace_back(i);
  }
  hld.build();

  for(Int i=0;i<q;i++){
    cin>>xs[i]>>ys[i]>>us[i]>>vs[i];
    us[i]--;vs[i]--;
    D[xs[i]].emplace_back(i);
  }

  auto f=[&](Int a,Int b){return a+b;};
  Int ti=0;
  SegmentTree<Int> cnt(f,ti);
  SegmentTree<Int> sum(f,ti);
  cnt.build(vector<Int>(n,0));
  sum.build(vector<Int>(n,0));

  for(Int i=1;i<n;i++){
    Int ch=hld.dep[as[i]]>hld.dep[bs[i]]?as[i]:bs[i];
    sum.set_val(hld.vid[ch],ds[i]);
  }

  vector<Int> ans(q,0);
  for(Int i=0;i<q;i++){
    Int res=0;
    auto qry=[&](Int l,Int r){res+=sum.query(l,r+1);};
    hld.for_each_edge(us[i],vs[i],qry);
    ans[i]+=res;
  }
  sum.build(vector<Int>(n,0));

  for(Int t=1;t<n;t++){
    for(Int i:C[t]){
      Int ch=hld.dep[as[i]]>hld.dep[bs[i]]?as[i]:bs[i];
      cnt.set_val(hld.vid[ch],1);
      sum.set_val(hld.vid[ch],ds[i]);
    }

    for(Int i:D[t]){
      Int res=0,num=0;
      auto qry=[&](Int l,Int r){
                 num+=cnt.query(l,r+1);
                 res+=sum.query(l,r+1);
               };
      hld.for_each_edge(us[i],vs[i],qry);
      ans[i]+=num*ys[i];
      ans[i]-=res;
    }

    for(Int i:C[t]){
      Int ch=hld.dep[as[i]]>hld.dep[bs[i]]?as[i]:bs[i];
      cnt.set_val(hld.vid[ch],0);
      sum.set_val(hld.vid[ch],0);
    }
  }

  for(Int i=0;i<q;i++) cout<<ans[i]<<"\n";
  cout<<flush;
  return 0;
}


Measured memory_bytes: 34920