using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;


struct Edge {
    public int From, To, Color, Length;
}

public class LCA {
    private readonly int N;
    private readonly int PN;
    private readonly int[][] _par;
    private readonly int[] _depth;
    private readonly long[] _cost;
    private readonly List<Edge>[] _adj;

    struct Edge {
        public int To;
        public int Cost;
    }

    public LCA(int n) {
        N = n;
        PN = 0;
        while ((1 << PN) < N) PN++;
        _adj = Enumerable.Range(0, n).Select(_ => new List<Edge>()).ToArray();
        _par = new int[N][];
        for (int i = 0; i < N; i++) {
            _par[i] = new int[PN];
        }
        _depth = new int[N];
        _cost = new long[N];
    }

    public void AddEdge(int from, int to, int cost) {
        _adj[from].Add(new Edge { To = to, Cost = cost });
    }

    private void Dfs(int current, int dep = 0, int cost = 0, int parent = -1) {
        _par[current][0] = parent;
        _depth[current] = dep;
        _cost[current] = cost;

        foreach (var child in _adj[current]) {
            if (child.To == parent) continue;
            Dfs(child.To, dep + 1, cost + child.Cost, current);
        }
    }

    public void Build(int root) {
        Dfs(root);

        for (int i = 1; i < PN; i++) {
            for (int j = 0; j < N; j++) {
                var pj = _par[j];
                var parent = pj[i - 1];
                pj[i] = parent == -1 ? -1 : _par[parent][i - 1];
            }
        }
    }

    public int GetLCA(int a, int b) {
        if (a == b) return a;
        if (_depth[a] > _depth[b]) return GetLCA(b, a);
        var diffDepth = _depth[b] - _depth[a];
        for (int i = PN - 1; i >= 0; i--) {
            if (diffDepth >= (1 << i)) {
                diffDepth -= 1 << i;
                b = _par[b][i];
            }
        }
        if (a == b) return a;
        for (int i = PN - 1; i >= 0; i--) {
            var pa = _par[a][i];
            var pb = _par[b][i];
            if (pa != pb && pa != -1 && pb != -1) {
                a = pa;
                b = pb;
            }
        }
        return _par[a][0];
    }

    public int Length(int a, int b) {
        var c = GetLCA(a, b);
        return _depth[a] + _depth[b] - 2 * _depth[c];
    }

    public long GetCost(int a, int b) {
        var c = GetLCA(a, b);
        return _cost[a] + _cost[b] - 2 * _cost[c];
    }
}

struct Query {
    public int Color, AfterLen, P1, P2;
}

internal partial class Solver {
    struct QueryInfo {
        public long Sum;
        public long Count;
    }
    Dictionary<int, QueryInfo>[] ColorSums;
    long[] Sum;
    long[] Count;


    public void Run() {
        var N = ni();
        var Q = ni();
        var adj = Enumerable.Range(0, N).Select(_ => new List<Edge>()).ToArray();

        var lca = new LCA(N);
        for (int i = 0; i < N - 1; i++) {
            var a = ni() - 1;
            var b = ni() - 1;
            var c = ni() - 1;
            var d = ni();
            adj[a].Add(new Edge { From = a, To = b, Color = c, Length = d });
            adj[b].Add(new Edge { From = b, To = a, Color = c, Length = d });
            lca.AddEdge(a, b, d);
            lca.AddEdge(b, a, d);
        }
        var query = new Query[Q];
        for (int i = 0; i < Q; i++) {
            query[i] = new Query {
                Color = ni() - 1,
                AfterLen = ni(),
                P1 = ni() - 1,
                P2 = ni() - 1,
            };
        }
        ColorSums = Enumerable.Range(0, N).Select(_ => new Dictionary<int, QueryInfo>()).ToArray();
        lca.Build(0);
        foreach (var q in query) {
            ColorSums[q.P1][q.Color] = default(QueryInfo);
            ColorSums[q.P2][q.Color] = default(QueryInfo);
            var c = lca.GetLCA(q.P1, q.P2);
            ColorSums[c][q.Color] = default(QueryInfo);
        }
        Sum = new long[N];
        Count = new long[N];
        Dfs(adj, 0);

        foreach (var q in query) {
            long distance = lca.GetCost(q.P1, q.P2);
            var c = lca.GetLCA(q.P1, q.P2);
            var info1 = ColorSums[q.P1][q.Color];
            var info2 = ColorSums[q.P2][q.Color];
            var info3 = ColorSums[c][q.Color];

            distance -= info1.Sum + info2.Sum - 2 * info3.Sum;
            distance += (info1.Count + info2.Count - 2 * info3.Count) * q.AfterLen;

            cout.WriteLine(distance);
        }
    }

    private void Dfs(List<Edge>[] adj, int v, int parent = -1) {
        foreach (var color in ColorSums[v].Keys.ToArray()) {
            ColorSums[v][color] = new QueryInfo {
                Sum = Sum[color],
                Count = Count[color],
            };
        }

        foreach (var e in adj[v]) {
            if (e.To == parent) continue;
            Sum[e.Color] += e.Length;
            Count[e.Color] += 1;
            Dfs(adj, e.To, v);
            Sum[e.Color] -= e.Length;
            Count[e.Color] -= 1;
        }
    }
}

// PREWRITEN CODE BEGINS FROM HERE
internal partial class Solver : Scanner {
    public static void Main(string[] args) {
#if LOCAL
        new Solver(Console.In, Console.Out).Run();
#else
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver(Console.In, Console.Out).Run();
        Console.Out.Flush();
#endif
    }

    public void RunMulti() {
        while (HasNext()) {
            Run();
        }
    }

#pragma warning disable IDE0052
    private readonly TextReader cin;
    private readonly TextWriter cout;
#pragma warning restore IDE0052

    public Solver(TextReader reader, TextWriter writer)
        : base(reader) {
        cin = reader;
        cout = writer;
    }
    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer) {
    }

#pragma warning disable IDE1006
#pragma warning disable IDE0051
    private int ni() { return NextInt(); }
    private int[] ni(int n) { return NextIntArray(n); }
    private long nl() { return NextLong(); }
    private long[] nl(int n) { return NextLongArray(n); }
    private double nd() { return NextDouble(); }
    private double[] nd(int n) { return NextDoubleArray(n); }
    private string ns() { return Next(); }
    private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}

public static class LinqPadExtension {
    public static T Dump<T>(this T obj) {
#if LOCAL
        return LINQPad.Extensions.Dump(obj);
#else
        return obj;
#endif
    }
}
public class Scanner {
    private readonly TextReader Reader;
    private readonly Queue<string> TokenQueue = new Queue<string>();
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    public Scanner()
        : this(Console.In) {
    }

    public Scanner(TextReader reader) {
        Reader = reader;
    }

    public int NextInt() { return int.Parse(Next(), ci); }
    public long NextLong() { return long.Parse(Next(), ci); }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size) {
        var array = new string[size];
        for (var i = 0; i < size; i++) {
            array[i] = Next();
        }

        return array;
    }
    public int[] NextIntArray(int size) {
        var array = new int[size];
        for (var i = 0; i < size; i++) {
            array[i] = NextInt();
        }

        return array;
    }

    public long[] NextLongArray(int size) {
        var array = new long[size];
        for (var i = 0; i < size; i++) {
            array[i] = NextLong();
        }

        return array;
    }

    public double[] NextDoubleArray(int size) {
        var array = new double[size];
        for (var i = 0; i < size; i++) {
            array[i] = NextDouble();
        }

        return array;
    }

    public string Next() {
        if (TokenQueue.Count == 0) {
            if (!StockTokens()) {
                throw new InvalidOperationException();
            }
        }
        return TokenQueue.Dequeue();
    }

    public bool HasNext() {
        if (TokenQueue.Count > 0) {
            return true;
        }

        return StockTokens();
    }

    private static readonly char[] _separator = new[] { ' ', '\t' };
    private bool StockTokens() {
        while (true) {
            var line = Reader.ReadLine();
            if (line == null) {
                return false;
            }

            var tokens = line.Split(_separator, StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length == 0) {
                continue;
            }

            foreach (var token in tokens) {
                TokenQueue.Enqueue(token);
            }

            return true;
        }
    }
}


Measured memory_bytes: 103768