#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

struct Edge{
  int to,color,cost;
};

struct Query{
  int color,cost,u,v;
};

//LowestCommonAncestor
//ダブリングを使う 前処理O(Nlog N),クエリO(log N)
class LowestCommonAncestor{
  using ll=long long;
  private:

  ll n,bit;
  std::vector<ll> depth;
  std::vector<std::vector<ll>> par_doubling;
  std::vector<std::vector<Edge>> graph;

  ll getbit(ll temp){
    ll a=1;
    while(temp>0){
      a++;
      temp>>=1;
    }
    return a;
  }

  void dfs(ll now,ll par,ll dep){
    depth[now]=dep;
    if(par!=-1)par_doubling[now][0]=par;
    else par_doubling[now][0]=now;

    for(auto e:graph[now]){
      if(e.to!=par){
        dfs(e.to,now,dep+1);
      }
    }
  }

  void doubling(){
    for(ll i=1;i<bit;i++){
      for(ll j=0;j<n;j++){
        par_doubling[j][i]=par_doubling[par_doubling[j][i-1]][i-1];
      }
    }
  }

  public:

  //隣接リストのグラフと木の根を渡す
  LowestCommonAncestor(const std::vector<std::vector<Edge>>& g,ll root_):graph(g),n(g.size()),bit(getbit(g.size())),
                                                              depth(n),par_doubling(n,std::vector<ll>(bit)){
    dfs(root_,-1,0);
    doubling();
  }
  
  ll query(ll a,ll b){
    if(depth[a]<depth[b])std::swap(a,b);

    for(ll i=0;i<bit;i++){
      if(((depth[a]-depth[b])>>i)&1)a=par_doubling[a][i];
    }

    if(a==b)return a;

    for(ll i=bit-1;i>=0;i--){
      if(par_doubling[a][i]!=par_doubling[b][i]){
        a=par_doubling[a][i];
        b=par_doubling[b][i];
      }
    }

    return par_doubling[a][0];
  }

};

int n,q;
std::vector<Query> query;
std::vector<std::pair<int,int>> need[100010];

int sum[100010],cnt[100010],len[100010];

std::map<std::tuple<int,int,int>,int> len_query;

void dfs(int now,int par,std::vector<std::vector<Edge>>& graph){
  for(auto e:need[now]){
    len_query[std::make_tuple(now,e.first,e.second)]=len[now]-sum[e.first]+e.second*cnt[e.first];
  }
  for(auto e:graph[now]){
    if(e.to!=par){
      len[e.to]=len[now]+e.cost;
      sum[e.color]+=e.cost;
      cnt[e.color]++;
      dfs(e.to,now,graph);
      sum[e.color]-=e.cost;
      cnt[e.color]--;
    }
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  std::cin>>n>>q;

  std::vector<std::vector<Edge>> graph(n);

  rep(i,0,n-1){
    int a,b,c,d;
    std::cin>>a>>b>>c>>d;
    a--;b--;
    graph[a].push_back({b,c,d});
    graph[b].push_back({a,c,d});
  }

  LowestCommonAncestor lca(graph,0);

  rep(i,0,q){
    int x,y,u,v;
    std::cin>>x>>y>>u>>v;
    u--;v--;
    need[u].push_back({x,y});
    need[v].push_back({x,y});
    need[lca.query(u,v)].push_back({x,y});
    query.push_back({x,y,u,v});
  }

  dfs(0,-1,graph);

  rep(i,0,q){
    int l=lca.query(query[i].u,query[i].v);
    int ans=0;
    ans+=len_query[std::make_tuple(query[i].u,query[i].color,query[i].cost)];
    ans+=len_query[std::make_tuple(query[i].v,query[i].color,query[i].cost)];
    ans-=2*len_query[std::make_tuple(l,query[i].color,query[i].cost)];
    std::cout<<ans<<"\n";
  }

  return 0;
}


Measured memory_bytes: 64688