///////////////////////////////////////////////////////////////////////////////

#include <bits/stdc++.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>

using namespace std;

///////////////////////////////////////////////////////////////////////////////

#define DEBUG 0

#define pb push_back
#define V vector
#define M unordered_map
#define S static
#define PI  (3.1415926535)

#define rep(i,n) for(ll i=0LL; i<n; ++i)
#define srep(i,s,n) for(ll i=s; i<n; ++i)
#define rrep(i,n) for(ll i=n-1LL; i>=0LL; --i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CIN(x) do { \
        assert(!cin.eof()); \
        cin >> x; \
        assert(!cin.fail()); \
} while(0);
#if DEBUG
#define debug_print(...) _debug_print(__VA_ARGS__)
#define debug_printf(...) printf(__VA_ARGS__)
#define debug_print_time _debug_print_time
#else // DEBUG
#define debug_print(...)
#define debug_printf(...)
#define debug_print_time
#endif // DEBUG

typedef long long ll;
typedef unsigned long long ull;
typedef tuple<ll, ll> t2;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;
template <typename T>
using priority_queue_incr = priority_queue<T, V<T>, greater<T> >;

///////////////////////////////////////////////////////////////////////////////

template <typename TT, typename T>
T get_m(M<TT, T> &m, TT k, T default_value)
{
    if (m.find(k) == m.end()) return m[k] = default_value;
    return m[k];
}

template <typename TT, typename T>
void incr_m(M<TT, T> &m, TT k)
{
    if (m.find(k) == m.end()) m[k] = 0;
    m[k]++;
}

void llin(ll &a)
{
    CIN(a);
}

void llinl1(V<ll> &v, ll count)
{
    for (ll i = 0LL; i < count; ++i) {
        ll a;
        CIN(a);
        v.push_back(a);
    }
}

void llinl2(V<t2> &v, ll count)
{
    for (ll i = 0LL; i < count; ++i) {
        ll a, b;
        CIN(a >> b);
        v.push_back(t2(a, b));
    }
}

void llinl3(V<t3> &v, ll count)
{
    for (ll i = 0LL; i < count; ++i) {
        ll a, b, c;
        CIN(a >> b >> c);
        v.push_back(t3(a, b, c));
    }
}

void llinl4(V<t4> &v, ll count)
{
    for (ll i = 0LL; i < count; ++i) {
        ll a, b, c, d;
        CIN(a >> b >> c >> d);
        v.push_back(t4(a, b, c, d));
    }
}

void llina(V<ll> &v, ll count)
{
    llinl1(v, count);
}

template <typename T>
void sort(V<T> &v)
{
    sort(v.begin(), v.end());
}

template <typename T>
void sort_reverse(V<T> &v)
{
    sort(v.begin(), v.end(), greater<T>());
}

template <typename T>
void _debug_print(T x)
{
    cout << x << endl;
}

void _debug_print(const t2 &x)
{
    ll x1 = get<0>(x);
    ll x2 = get<1>(x);
    cout << "-- " << x1 << " -- " << x2 << endl;
}

void _debug_print(const t3 &x)
{
    ll x1 = get<0>(x);
    ll x2 = get<1>(x);
    ll x3 = get<2>(x);
    cout << "-- " << x1 << " -- " << x2 << " -- " << x3 << endl;
}

void _debug_print(const t4 &x)
{
    ll x1 = get<0>(x);
    ll x2 = get<1>(x);
    ll x3 = get<2>(x);
    ll x4 = get<3>(x);
    cout << "-- " << x1 << " -- " << x2
         << " -- " << x3 << " -- " << x4 << endl;
}

template <typename T>
void _debug_print(T xarray[], ll n)
{
    rep (i, n) _debug_print(xarray[i]);
}

template <typename T>
void _debug_print(const V<T> &xlist)
{
    for (auto x : xlist) {
        cout << "-- ";
        _debug_print(x);
    }
}

template <typename T>
void _debug_print(const set<T> &xset)
{
    for (auto x : xset) {
        cout << "-- ";
        _debug_print(x);
    }
}

template <typename TT, typename T>
void _debug_print(const M<TT, T> &xlist)
{
    for (auto x : xlist) {
        TT k = x.first;
        T v = x.second;
        cout << "====" << endl;
        cout << "K=";
        _debug_print(k);
        cout << "V=";
        _debug_print(v);
    }
}

void _debug_print_time(const char *prefix)
{
    struct timeval tv;
    gettimeofday(&tv, NULL);
    struct tm *tm = localtime(&tv.tv_sec);
    printf("-- %s %02d:%02d:%02d.%06ld\n",
           prefix, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec);
}



void make_edgelist(const V<t4> &srclist, V<ll> edgelist[])
{
    for (auto src : srclist) {
        ll a = get<0>(src);
        ll b = get<1>(src);
        edgelist[a].pb(b);
        edgelist[b].pb(a);
    }
}

void make_edgelist4(const V<t4> &srclist, V<t3> edgelist[])
{
    for (auto src : srclist) {
        ll a = get<0>(src);
        ll b = get<1>(src);
        ll c = get<2>(src);
        ll d = get<3>(src);
        edgelist[a].pb(t3(b, c, d));
        edgelist[b].pb(t3(a, c, d));
    }
}



void make_parental_relation(const V<t3> edge_cd_list[], ll root, ll n,
                            ll parents[], V<t3> children[], ll levels[])
{
    queue<ll> q;
    bool checked[n+1];

    memset(checked, 0, sizeof(checked));

    q.push(root);
    checked[root] = true;
    parents[root] = root;
    levels[root] = 0LL;

    for ( ; !(q.empty()); ) {
        ll now = q.front(); q.pop();
        for (auto next_item : edge_cd_list[now]) {
            ll next = get<0>(next_item);
            ll c = get<1>(next_item);
            ll d = get<2>(next_item);
            if (checked[next]) continue;
            q.push(next);
            checked[next] = true;
            parents[next] = now;
            children[now].pb(t3(next, c, d));
            levels[next] = levels[now] + 1LL;
        }
    }
}



#define POW_ANCESTOR_MAXSIZE   20

// preprocess for get_common_ancestor()
void make_pow_ancestor(const ll parent[], ll n,
                       ll (*pow_ancestor)[POW_ANCESTOR_MAXSIZE])
{
    rep (i, n) pow_ancestor[i+1][0] = parent[i+1];

    for (int pow2 = 1; pow(2, pow2) <= n; ++pow2) {
        rep (i0, n) {
            int i = i0+1;
            ll prev = pow_ancestor[i][pow2-1];
            pow_ancestor[i][pow2] = pow_ancestor[prev][pow2-1];
        }
    }
}

ll get_common_ancestor(ll n, ll x, ll y,
                       const ll (*pow_ancestor)[POW_ANCESTOR_MAXSIZE],
                       const ll level[])
{
    if (level[x] < level[y]) {
        ll diff = level[y] - level[x];
        for ( ; diff; ) {
            ll bit = diff & -diff;
            y = pow_ancestor[y][(int)log2(bit)];
            diff -= bit;
        }
    }
    else {
        ll diff = level[x] - level[y];
        for ( ; diff; ) {
            ll bit = diff & -diff;
            x = pow_ancestor[x][(int)log2(bit)];
            diff -= bit;
        }
    }

    if (x == y) return x;

    rrep (i, (int)log2(n)+1) {
        if (pow_ancestor[x][i] != pow_ancestor[y][i]) {
            x = pow_ancestor[x][i];
            y = pow_ancestor[y][i];
        }
    }

    return pow_ancestor[x][0];
}




///////////////////////////////////////////////////////////////////////////////

void _main();
int main()
{
    cout << setprecision(12);
#if !DEBUG
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif

    _main();
    return 0;
}

#if DEBUG
#define BORDER ((ll)1e7)
#else
#define BORDER (34928751LL)
#endif

S ll now_cnts[100005] = {};
S ll now_dlist[100005] = {};


void dfs(M<ll, ll> &vc_cnts, M<ll, ll> &vc_dlist, ll depths[],
         ll now_cnts[], ll now_dlist[], ll now_depth,
         const V<t3> children[], const set<ll> colors[], ll v)
{
    for (auto c : colors[v]) {
        ll idx = v * BORDER + c;
        vc_cnts[idx] = now_cnts[c];
        vc_dlist[idx] = now_dlist[c];
    }

    depths[v] = now_depth;

    for (auto item : children[v]) {
        ll cv = get<0>(item);
        ll c = get<1>(item);
        ll d = get<2>(item);

        now_cnts[c]++;
        now_dlist[c] += d;
        now_depth += d;

        dfs(vc_cnts, vc_dlist, depths,
            now_cnts, now_dlist, now_depth, children, colors, cv);

        now_cnts[c]--;
        now_dlist[c] -= d;
        now_depth -= d;
    }
}

void _main()
{
    ll n; llin(n);
    ll qcnt; llin(qcnt);
    V<t4> uv_cd_list; llinl4(uv_cd_list, n-1);
    V<t4> qlist; llinl4(qlist, qcnt);

    S V<ll> edgelist[100005];
    make_edgelist(uv_cd_list, edgelist);

    S V<t3> edge_cd_list[100005];
    make_edgelist4(uv_cd_list, edge_cd_list);

    S ll parents[100005];
    S V<t3> children[100005];
    S ll levels[100005];
    make_parental_relation(edge_cd_list, 1, n, parents, children, levels);

    S ll pow_ancestor[100005][POW_ANCESTOR_MAXSIZE];
    make_pow_ancestor(parents, n, pow_ancestor);

    S set<ll> colors[100005];
    for (auto q : qlist) {
        ll c = get<0>(q);
        ll v1 = get<2>(q);
        ll v2 = get<3>(q);
        ll av = get_common_ancestor(n, v1, v2, pow_ancestor, levels);
        colors[v1].insert(c);
        colors[v2].insert(c);
        colors[av].insert(c);
    }

    S M<ll, ll> vc_cnts;
    S M<ll, ll> vc_dlist;
    S ll depths[100005];
    S ll now_cnts[100005] = {};
    S ll now_dlist[100005] = {};
    ll now_depth = 0;

    dfs(vc_cnts, vc_dlist, depths,
        now_cnts, now_dlist, now_depth, children, colors, 1);

    debug_printf("---- vc_cnts\n");
    debug_print(vc_cnts);
    debug_printf("--- vc_dlist\n");
    debug_print(vc_dlist);
    debug_printf("---- depths\n");
    debug_print(depths, 8);

    debug_printf("---- ans\n");

    for (auto q : qlist) {
        ll c = get<0>(q);
        ll d = get<1>(q);
        ll v1 = get<2>(q);
        ll v2 = get<3>(q);

        ll av = get_common_ancestor(n, v1, v2, pow_ancestor, levels);

        ll depth1 = depths[v1] - vc_dlist[v1*BORDER+c] + vc_cnts[v1*BORDER+c] * d;
        ll depth2 = depths[v2] - vc_dlist[v2*BORDER+c] + vc_cnts[v2*BORDER+c] * d;
        ll depth_av = depths[av] - vc_dlist[av*BORDER+c] + vc_cnts[av*BORDER+c] * d;

        cout << depth1 + depth2 - depth_av * 2LL << endl;
    }
}

///////////////////////////////////////////////////////////////////////////////


Measured memory_bytes: 90084