import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;

public class Main{

    private static int MAX_ASCENDANTS = 20;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int q = sc.nextInt();
        Node nodes[] = new Node[n];
        for (int i=0; i<n; i++) nodes[i] = new Node(i);
        List<ColorChange> colors[] = new List[n];
        for (int i=0; i<n; i++) colors[i] = new ArrayList<>();

        for (int i=0; i<n-1; i++){
            int a = sc.nextInt()-1;
            int b = sc.nextInt()-1;
            int c = sc.nextInt();
            int d = sc.nextInt();
            nodes[a].edges.add(new Edge(c, d, nodes[b]));
            nodes[b].edges.add(new Edge(c, d, nodes[a]));
        }

        dfs(nodes[0], null, 0, 0, 0, colors);

        for (int i=1; i<MAX_ASCENDANTS; i++){
            for (int j=0; j<n; j++){
                if (nodes[j].ascendants[i-1]!=null) nodes[j].ascendants[i]=nodes[nodes[j].ascendants[i-1].id].ascendants[i-1];
            }
        }
        for (int i=0; i<n; i++){
            for (int j=1; j<colors[i].size(); j++){
                ColorChange prev = colors[i].get(j-1);
                ColorChange next = colors[i].get(j);
                next.num += prev.num;
                next.dist += prev.dist;
            }
        }

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<q; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int u = sc.nextInt()-1;
            int v = sc.nextInt()-1;
            Node lca = lca(nodes[u], nodes[v]);
            List<ColorChange> c = colors[x];
            sb.append(dist(nodes[u], c, y) + dist(nodes[v], c, y) - 2*dist(lca, c, y)).append('\n');
        }
        System.out.println(sb.toString());
    }


    private static long dist(Node node, List<ColorChange> changes, int newLen){
        long d = node.dist;
        ColorChange c = upperBound(changes, node.order);
        if (c!=null){
            d += (long) c.num*newLen -c.dist;
        }
        return d;
    }

    private static ColorChange upperBound(List<ColorChange> a, int k){
        int left = -1;
        int right = a.size();
        while (right-left>1){
            int mid = (left+right)/2;
            if (a.get(mid).pos<=k){
                left=mid;
            }else{
                right=mid;
            }
        }
        if (left<0)return null;
        return a.get(left);
    }

    private static Node lca(Node u, Node v){
        if (u.depth>v.depth) return lca(v,u);
        for (int i=0; i<MAX_ASCENDANTS; i++){
            int diff = v.depth-u.depth;
            if ((diff & (1<<i))!=0){
                v = v.ascendants[i];
            }
        }
        if (u==v)return u;
        for (int i=MAX_ASCENDANTS-1; i>=0; i--){
            if (u.ascendants[i]!=v.ascendants[i]){
                u=u.ascendants[i];
                v=v.ascendants[i];
            }
        }
        return u.ascendants[0];
    }

    private static int dfs(Node node, Node parent, int order, int depth, int dist, List<ColorChange>[] colors){
        node.ascendants[0] = parent;
        node.order = order;
        node.depth = depth;
        node.dist = dist;
        for (Edge e : node.edges){
            if (e.to!=parent){
                order++;
                colors[e.color].add(new ColorChange(order, 1, e.length));
                order = dfs(e.to, node, order, depth+1, dist+e.length, colors);
                colors[e.color].add(new ColorChange(order+1, -1, -e.length));
            }
        }
        return order;
    }


    private static class Edge{
        final int color;
        final int length;
        final Node to;

        private Edge(int color, int length, Node to){
            this.color = color;
            this.length = length;
            this.to = to;
        }
    }

    private static class Node{
        final int id;
        int order;
        int depth;
        int dist;
        List<Edge> edges = new ArrayList<>();
        Node ascendants[] = new Node[MAX_ASCENDANTS];

        private Node(int id){
            this.id = id;
        }
    }

    private static class ColorChange{
        final int pos;
        int dist;
        int num;

        private ColorChange(int pos, int num, int dist){
            this.pos = pos;
            this.num = num;
            this.dist = dist;
        }
    }
}





Measured memory_bytes: 235924