#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

template <class T>
class EdgeBase
{
public:
    int to, color;
    T cost;
    EdgeBase(){};
    EdgeBase(int to0, int color0, T cost0){to = to0; color=color0; cost = cost0;}
};
typedef EdgeBase<int> Edge;

template<class T>
class LowestCommonAncestor
{
private:
    vector<vector<int> > to; // ダブリング先のノード
    vector<int> depth;       // 根からの深さ
    vector<T> dist;          // 根からの距離
    int climb(int curr, int len)
    {
        int i = 0;
        while(len > 0){
            if(len % 2 == 1)
                curr = to[curr][i];
            len /= 2;
            ++ i;
        }
        return curr;
    }
public:
    LowestCommonAncestor(const vector<vector<EdgeBase<T> > >& edges, int root)
    {
        int n = edges.size();
        to.assign(n, vector<int>());
        dist.assign(n, 0);
        depth.assign(n, 0);

        queue<pair<int, int> > q;
        q.push(make_pair(root, -1));

        int cnt = 0;
        while(!q.empty()){
            int m = q.size();
            while(--m >= 0){
                int curr, prev;
                tie(curr, prev) = q.front();
                q.pop();

                if(prev != -1){
                    to[curr].push_back(prev);
                    int j = prev;
                    for(unsigned k=0; k<to[j].size(); ++k){
                        j = to[j][k];
                        to[curr].push_back(j);
                    }
                }

                for(const EdgeBase<T>& e : edges[curr]){
                    if(e.to != prev){
                        depth[e.to] = depth[curr] + 1;
                        dist[e.to] = dist[curr] + e.cost;
                        q.push(make_pair(e.to, curr));
                    }
                }
            }
            ++ cnt;
        }
    }
    // 2つのノードの最小共通祖先を取得
    int getAncestor(int a, int b)
    {
        int diff = depth[a] - depth[b];
        if(diff < 0)
            b = climb(b, -diff);
        else
            a = climb(a, diff);
        if(a == b)
            return a;

        for(int i=to[a].size()-1; i>=0; --i){
            if(i < (int)to[a].size() && to[a][i] != to[b][i]){
                a = to[a][i];
                b = to[b][i];
            }
        }
        return to[a][0];
    }
    // ノードの深さを取得
    int getDepth(int a)
    {
        return depth[a];
    }
    // 2つのノードの距離を取得
    T getDist(int a, int b)
    {
        int c = getAncestor(a, b);
        return dist[a] + dist[b] - dist[c] * 2;
    }
};

vector<vector<Edge> > edges;
vector<map<int, int> > cnt, sum;

void dfs(int curr, int prev, vector<int>& v1, vector<int>& v2)
{
    for(auto& p : cnt[curr])
        p.second = v1[p.first];
    for(auto& p : sum[curr])
        p.second = v2[p.first];

    for(const Edge& e : edges[curr]){
        if(e.to == prev)
            continue;
        ++ v1[e.color];
        v2[e.color] += e.cost;
        dfs(e.to, curr, v1, v2);
        -- v1[e.color];
        v2[e.color] -= e.cost;
    }
}

int main()
{
    int n, q;
    cin >> n >> q;
    edges.assign(n, vector<Edge>());
    for(int i=0; i<n-1; ++i){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        -- a;
        -- b;
        -- c;
        edges[a].push_back(Edge(b, c, d));
        edges[b].push_back(Edge(a, c, d));
    }
    LowestCommonAncestor<int> lca(edges, 0);

    vector<int> x(q), y(q), u(q), v(q);
    cnt.assign(n, map<int, int>());
    for(int i=0; i<q; ++i){
        cin >> x[i] >> y[i] >> u[i] >> v[i];
        -- x[i];
        -- u[i];
        -- v[i];
        cnt[u[i]][x[i]];
        cnt[v[i]][x[i]];
        int w = lca.getAncestor(u[i], v[i]);
        cnt[w][x[i]];
    }
    sum = cnt;
    vector<int> v1(n, 0), v2(n, 0);
    dfs(0, -1, v1, v2);

    for(int i=0; i<q; ++i){
        int w = lca.getAncestor(u[i], v[i]);
        int ans = lca.getDist(u[i], v[i]);
        ans -= sum[u[i]][x[i]] + sum[v[i]][x[i]] - 2 * sum[w][x[i]];
        ans += (cnt[u[i]][x[i]] + cnt[v[i]][x[i]] - 2 * cnt[w][x[i]]) * y[i];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 52152