#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll x, ll y){return x / gcd(x, y) * y % MOD;};



const ll MAX_V = 200010;
const ll MAX_LOG_V = 30;
vector<ll> G[MAX_V];
ll root = 0;//根のノード番号

ll parent[MAX_LOG_V][MAX_V];
//2^k回親をたどって到達する点
//根を通り過ぎる時は-1

ll depth[MAX_V];
void dfs1(ll v, ll p, ll d){
  parent[0][v] = p;
  depth[v] = d;
  for(ll to : G[v]){
    if(to == p) continue;
    dfs1(to, v, d + 1);
  }
}
void init(ll V){
  dfs1(root, -1, 0);
  for(ll k = 0; k + 1 < MAX_LOG_V; k++){
    for(ll v = 0; v < V; v++){
      if(parent[k][v] < 0) parent[k+1][v] = -1;
      else parent[k+1][v] = parent[k][parent[k][v]];
    }
  }
}
//uとvのLCAを求める
ll lca(ll u, ll v){
  if(depth[u] > depth[v]) swap(u, v);
  for(ll k = 0; k < MAX_LOG_V; k++){
    if((depth[v] - depth[u]) >> k & 1){
      v = parent[k][v];
    }
  }
  if(u == v) return u;
  //二分探索でLCAを求める
  for(ll k = MAX_LOG_V - 1; k >= 0; k--){
    if(parent[k][u] != parent[k][v]){
      u = parent[k][u];
      v = parent[k][v];
    }
  }
  return parent[0][u];
}

ll n, q;
struct edge{ll to, color, cost;};
vector<edge> E[100010];
struct query{ll color, cost, t, qid;};
vector<query> Q[100010];//頂点にくっつける
ll d[100010];
void dfs2(ll now, ll from){//頂点からの距離を求める
  rep(i, E[now].size()){
    edge e = E[now][i];
    if(e.to == from) continue;
    d[e.to] = d[now] + e.cost;
    dfs2(e.to, now);
  }
}
ll cnt[100010];//色ごとの回数
ll sum[100010];
ll ans[100010];
void dfs3(ll now, ll from){
  rep(i, Q[now].size()){
    query que = Q[now][i];
    ll dx = que.cost * cnt[que.color] - sum[que.color];
    ans[que.qid] += dx * que.t;
  }
  rep(i, E[now].size()){
    edge e = E[now][i];
    if(e.to == from) continue;
    cnt[e.color]++;
    sum[e.color] += e.cost;
    dfs3(e.to, now);
    cnt[e.color]--;
    sum[e.color] -= e.cost;
  }
}

int main(){
  cin >> n >> q;
  rep(i, n-1){
    ll a, b, c, d; cin >> a >> b >> c >> d;
    a--, b--;
    edge e;
    e.to = b, e.color = c, e.cost = d;
    E[a].pb(e);
    e.to = a;
    E[b].pb(e);
    G[a].pb(b);
    G[b].pb(a);
  }
  init(n);
  d[0] = 0;
  dfs2(root, -1);
  rep(i, q){
    ll x, y, u, v; cin >> x >> y >> u >> v;
    u--, v--;
    ans[i] = d[u] + d[v] - 2 * d[lca(u, v)];
    query que;
    que.color = x;
    que.cost = y;
    que.t = 1;
    que.qid = i;
    Q[u].pb(que);
    Q[v].pb(que);
    que.t = -2;
    Q[lca(u, v)].pb(que);
  }
  dfs3(0, -1);
  rep(i, q) cout << ans[i] << endl;

}


Measured memory_bytes: 91376