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

#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <typeinfo>
#include <numeric>
#include <cassert>
#include <stdio.h>
#include <unistd.h>
#include <string.h>

using namespace std;

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

#define pb push_back
#define V vector
#define M unordered_map
#define rep(i,n) for(int i=0;i<n;++i)
#define srep(i,s,n) for(int i=s;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define ALL(a) (a).begin(),(a).end()
#define CIN(x) do { \
        assert(!cin.eof()); \
        cin >> x; \
        assert(!cin.fail()); \
} while(0);

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;

struct UnionFind
{
        ull *parent, *count, *rank;

        UnionFind(ull n) {
                parent = new ull[n+1];
                count = new ull[n+1];
                rank = new ull[n+1];
                for (ull i = 0ULL; i < n+1; ++i) {
                        parent[i] = i;
                        count[i] = 1;
                        rank[i] = 0;
                }
        }

        ull root(ull i) {
                if (parent[i] == i) return i;
                parent[i] = root(parent[i]);
                return parent[i];
        }

        void unite(ull i, ull j) {
                ull rooti = root(i);
                ull rootj = root(j);

                if (rooti == rootj) return;

                if (rank[rootj] < rank[rooti]) {
                        parent[i] = parent[j] = parent[rootj] = rooti;
                        count[rooti] += count[rootj];
                }
                else {
                        parent[i] = parent[j] = parent[rooti] = rootj;
                        count[rootj] += count[rooti];
                        if (rank[rootj] == rank[rooti]) rank[rootj]++;
                }
        }

        bool same(ull i, ull j) {
                return root(i) == root(j);
        }
};

struct BIT
{
        ll *tree;
        ll size;

        BIT(ll n, ll init) {
                tree = new ll[n+1];
                size = n;
                rep (i, n+1) tree[i] = init;
        }

        // idx is 1 origin
        void add(ll idx, ll x) {
                assert(idx > 0LL);
                while (idx <= size) {
                        tree[idx] += x;
                        idx += (idx & (-idx));
                }
        }

        // idx is 1 origin
        ll sum(ll idx) {
                assert(idx > 0LL);
                ll ret = 0LL;
                while (idx > 0LL) {
                        ret += tree[idx];
                        idx -= (idx & (-idx));
                }
                return ret;
        }
};

struct MaxFlow {
        V<ll> links[1005];
        ll capacities[1005][1005];
        ll nodes;

        MaxFlow(ll nodes) {
                // i == 0       --> S
                // i == nodes+1 --> T
                rep (i, nodes+2LL) links[i].clear();
                memset(capacities, 0, sizeof(capacities));
                this->nodes = nodes;
        }

        void add_path(ll a, ll b, ll capacity) {
                links[a].pb(b);
                links[b].pb(a);
                capacities[a][b] = capacity;
                capacities[b][a] = 0LL;
        }

        ll solve(void) {
                deque<V<ll>> q;
                ll ret = 0LL;

                for ( ; ; q.clear()) {

                        V<ll> start;
                        start.pb(0);
                        q.push_front(start);

                        bool checked[nodes+2];
                        memset(checked, 0, sizeof(checked));

                        V<ll> found;

                        for ( ; !(q.empty()); ) {
                                V<ll> path = q.front(); q.pop_front();
                                ll last = path[path.size()-1];

                                if (checked[last]) continue;
                                if (last == nodes+1) {
                                        found = path;
                                        break;
                                }

                                checked[last] = true;
                                for (auto next : (links[last])) {
                                        if (capacities[last][next] == 0) continue;
                                        V<ll> newpath(path);
                                        newpath.pb(next);
                                        q.push_front(newpath);
                                }
                        }

                        if (found.size() == 0) {
                                break;
                        }
                        else {
                                ll flowcount = capacities[found[0]][found[1]];
                                rep (i, found.size()-1) {
                                        ll src = found[i];
                                        ll dst = found[i+1];
                                        flowcount = min(flowcount, capacities[src][dst]);
                                }
                                rep (i, found.size()-1) {
                                        ll src = found[i];
                                        ll dst = found[i+1];
                                        capacities[src][dst] -= flowcount;
                                        capacities[dst][src] += flowcount;
                                }
                                ret += flowcount;
                        }
                }

                return ret;
        }
};

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

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

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

void llinl3(auto &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(auto &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(auto &v, ll count)
{
        llinl1(v, count);
}

template <typename T>
T min(const V<T> v)
{
        T ret = v[0];
        for (auto i : v) ret = min(ret, i);
        return ret;
}

template <typename T>
T max(const V<T> v)
{
        T ret = v[0];
        for (auto i : v) ret = max(ret, i);
        return ret;
}

ll absll(ll x)
{
        if (x < 0) return -x;
        return x;
}

ll mod_mlt(ll x, ll y, ll mod)
{
        ll ret = 0LL;
        x %= mod;

        while (y) {
                if (y & 1LL) {
                        ret += x;
                        ret %= mod;
                }
                y >>= 1;
                x <<= 1;
                x %= mod;
        }

        return ret;
}

ll mod_pow(ll base, ll exp, ll mod)
{
        ll ret = 1LL;

        for ( ; exp; ) {
                if (exp & 1LL) {
                        ret *= base;
                        ret %= mod;
                }
                base = (base * base) % mod;
                exp >>= 1;
        }

        return ret;
}

ll mod_inv(ll x, ll mod)
{
        // available only when mod is prime
        return mod_pow(x, mod - 2LL, mod);
}

ll gcm(ll x, ll y)
{
        while (y != 0) {
                ll z = x % y;
                x = y;
                y = z;
        }
        return x;
}

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>());
}

void get_divisors(V<ll> &retlist, ll x)
{
        for (ll i = 1LL; i < sqrt(x) + 3LL; ++i) {
                if (x % i == 0LL) {
                        retlist.push_back(i);
                        retlist.push_back(x / i);
                }
        }
}

void get_factors(V<ll> &retlist, ll x)
{
        for (ll i = 2LL; i < (ll)(sqrt(x)) + 3LL; ++i) {
                while (x % i == 0LL) {
                        retlist.pb(i);
                        x /= i;
                }
        }
        retlist.pb(x);
}

bool is_prime(ll x)
{
        V<ll> factors, factors2;

        get_factors(factors, x);

        for (auto factor : factors) {
                if (factor > 1) factors2.pb(factor);
        }

        return factors2.size() == 1 && x == factors2[0];
}

template <typename T>
void intersection(const set<T> &a, const set<T> &b,
                  set<T> &result)
{
        set_intersection(ALL(a), ALL(b), inserter(result, result.end()));
}

ull combination(ll x, ll y)
{
        if (y > x / 2LL) y = x - y;

        ull ret = 1LL;
        for (ll i = 0LL; i < y; ++i) {
                ret *= x--;
                ret /= (i + 1LL);
        }

        return ret;
}

ull mod_combination(ll x, ll y, ll mod)
{
        if (y > x / 2LL) y = x - y;

        ll ret = 1;

        for (ll i = 0LL; i < y; ++i) {
                ret = (ret * x--) % mod;
                ret = (ret * mod_inv(i + 1LL, mod)) % mod;
        }

        return ret;
}

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

void make_parent(const V<ll> linklist[], ll root, ll n,
                 ll parent[], ll level[])
{
        queue<ll> q;
        bool checked[n+1];

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

        q.push(root);
        checked[root] = true;
        parent[root] = root;
        level[root] = 0LL;

        for ( ; !(q.empty()); ) {
                ll now = q.front(); q.pop();
                for (auto next : linklist[now]) {
                        if (checked[next]) continue;
                        q.push(next);
                        checked[next] = true;
                        parent[next] = now;
                        level[next] = level[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 debug_print(auto 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 S, typename T>
void debug_print(const M<S, T> &xlist)
{
        for (auto x : xlist) {
                S k = x.first;
                T v = x.second;
                cout << "====" << endl;
                cout << "K=";
                debug_print(k);
                cout << "V=";
                debug_print(v);
        }
}

int _main();
int main()
{
        cout << setprecision(12);
        return _main();
}

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

V<ll> linklist[100005];
V<t3> cdlinklist[100005];
ll parent[100005];
ll level[100005];
ll pow_ancestor[100005][POW_ANCESTOR_MAXSIZE];
int n_to_eulerpos[100005];
V<ll> dsumlist;
V<t2> cdsumlist[100005];
V<t2> cnsumlist[100005];

ll calc_distance(ll n_idx, ll color, ll newd)
{
        int eulerpos = n_to_eulerpos[n_idx];
        int left = 0;
        int right = cdsumlist[color].size()-1;
        int cdidx = (left + right) / 2;
        int ans_cdidx = -1LL;

        for ( ; left <= right; cdidx = (left + right) / 2) {
                ll tour_idx = get<0>(cdsumlist[color][cdidx]);
                if (eulerpos < tour_idx) right = cdidx - 1;
                if (eulerpos >= tour_idx) {
                        ans_cdidx = max(ans_cdidx, cdidx);
                        left = cdidx + 1;
                }
        }

        ll dsum = dsumlist[eulerpos];
        ll cdsum = (ans_cdidx >= 0LL) ? get<1>(cdsumlist[color][ans_cdidx]) : 0LL;
        ll cnsum = (ans_cdidx >= 0LL) ? get<1>(cnsumlist[color][ans_cdidx]) : 0LL;

        return dsum - cdsum + cnsum * newd;
}

int _main()
{
        ll n, nr_q;
        llin(n); llin(nr_q);

        V<t4> abcdlist;
        llinl4(abcdlist, n-1);

        V<t4> xyuvlist;
        llinl4(xyuvlist, nr_q);

        for (auto abcd : abcdlist) {
                ll a = get<0>(abcd);
                ll b = get<1>(abcd);
                ll c = get<2>(abcd);
                ll d = get<3>(abcd);
                linklist[a].pb(b);
                linklist[b].pb(a);
                cdlinklist[a].pb(t3(b, c, d));
                cdlinklist[b].pb(t3(a, c, d));
        }

        make_parent(linklist, 1LL, n, parent, level);
        make_pow_ancestor(parent, n, pow_ancestor);

        ll common_anc[100005];  // idx == q
        rep (i, nr_q) {
                ll u = get<2>(xyuvlist[i]);
                ll v = get<3>(xyuvlist[i]);
                common_anc[i] = get_common_ancestor(n, u, v, pow_ancestor, level);
        }

        V<t3> euler_tour;  // (idx, color, distance)
        deque<t3> stack;
        bool checked[100005];
        memset(checked, 0, sizeof(checked));

        stack.push_back(t3(1LL, -1LL, -1LL));
        checked[1] = true;

        for ( ; !(stack.empty()); ) {
                t3 sitem = stack.back(); stack.pop_back();
                ll now = get<0>(sitem);
                ll c = get<1>(sitem);
                ll d = get<2>(sitem);

                if (now < 0LL) {
                        euler_tour.pb(t3(-now, c, -d));
                        continue;
                }

                if (d >= 0LL) euler_tour.pb(t3(now, c, d));

                for (auto cdlink : cdlinklist[now]) {
                        ll next = get<0>(cdlink);
                        ll color = get<1>(cdlink);
                        ll distance = get<2>(cdlink);

                        if (checked[next]) continue;

                        stack.push_back(t3(-now, color, distance));
                        stack.push_back(t3(next, color, distance));
                        checked[next] = true;
                }
        }

        rep (i, 100005) n_to_eulerpos[i] = -1;

        rep (tour_idx, euler_tour.size()) {
                t3 e = euler_tour[tour_idx];
                ll n_idx = get<0>(e);
                ll color = get<1>(e);
                ll distance = get<2>(e);

                if (n_to_eulerpos[n_idx] < 0) n_to_eulerpos[n_idx] = tour_idx;

                if (dsumlist.empty()) dsumlist.pb(distance);
                else dsumlist.pb(dsumlist[dsumlist.size()-1] + distance);

                ll countup = (distance >= 0LL ? 1LL : -1LL);
                if (cdsumlist[color].empty()) {
                        cdsumlist[color].pb(t2(tour_idx, distance));
                        cnsumlist[color].pb(t2(tour_idx, countup));
                }
                else {
                        ll size = cdsumlist[color].size();
                        t2 prevd = cdsumlist[color][size-1LL];
                        t2 prevn = cnsumlist[color][size-1LL];
                        cdsumlist[color].pb(t2(tour_idx, get<1>(prevd) + distance));
                        cnsumlist[color].pb(t2(tour_idx, get<1>(prevn) + countup));
                }
        }

        rep (i, nr_q) {
                t4 xyuv = xyuvlist[i];
                ll color = get<0>(xyuv);
                ll newd = get<1>(xyuv);
                ll u = get<2>(xyuv);
                ll v = get<3>(xyuv);
                ll anc = common_anc[i];

                ll du = calc_distance(u, color, newd);
                ll dv = calc_distance(v, color, newd);
                ll danc = calc_distance(anc, color, newd);

                cout << du + dv - 2 * danc << endl;
        }

        return 0;
}

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


Measured memory_bytes: 67432