#include <iostream>
#include <cmath>
#include<vector>
#include <algorithm>
#include <utility>
#include<stack>
#include<queue>
#include<map>
#include <fstream>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long

    long long res[100010];
    long long csum[100010];
    long long cnum[100010];
    int p[100010][30];
    vector<pair<int,int>> upd[100010];
    int lvl[100010];
    long long dist[100010];

    struct susjed{
        int node,  color,  w;
        susjed(){}
        susjed(int node, int color, int w):node(node),color(color),w(w) {}
    };
    struct in{
        int u,v,color,d;
        in(){}
        in(int u, int v, int color, int d): u(u),v(v),color(color),d(d) {}
    };
    in qlist[100010];
    vector<vector<susjed>> adjl;
    void dfs( int x, int parent, int depth )
    {
        lvl[x]=depth;
        p[x][0]=parent;
        for( int i=0;i<adjl[x].size();i++ ){
            if( adjl[x][i].node != parent ) dfs( adjl[x][i].node, x, depth+1 );
        }
    }
    void dfs2( int x,int parent ,int len )
    {
        dist[x]=len;
  //      cout <<x << " " << dist[x] << " broo " <<endl;
        for( int i=0;i<upd[x].size();i++ ){
                 int id = upd[x][i].first;
                 int color = qlist[ id ].color;
                 int d = qlist[id].d;
            if( upd[x][i].second == 0 ){    ///obicni update
               res[id] += dist[x];
               res[id] -= csum[color];
               res[id] += cnum[color]*d;
            }
            else{   /// lca update
                res[id] -= 2*dist[x];
                res[id] += 2*csum[color];
                res[id] -= 2*cnum[color]*d;
            }
        }
        for( int i=0;i<adjl[x].size();i++ ){
            if( adjl[x][i].node == parent  ) continue;
            int color=adjl[x][i].color;
            int w = adjl[x][i].w;
            csum[color] += w;
            cnum[color]++;
            dfs2( adjl[x][i].node, x, len+w );
            csum[color]-=w;
            cnum[color]--;
        }
    }
    int lca( int a, int b )
    {
        if( lvl[a] < lvl[b] ) swap(a,b);
        int logg=0;
        for( logg=0;(1<<logg)<=lvl[a];logg++  );
        logg--;
     //     cout << " ooo  " <<endl;
        for( int i=logg;i>=0;i-- ){
            if( lvl[a] - ( 1<<i ) >= lvl[b] ) a=p[a][i];    /// izjednacimo nivoe
        }

        if( a==b ) return a;
        for( int i=logg;i>=0;i-- ){
            if( p[a][i]!=-1 && p[a][i] != p[b][i] ){
                a=p[a][i];
                b=p[b][i];
            }
        }
    //    cout <<  a << " " << p[a][0] << " kontas " <<endl;
        return p[a][0];
    }

    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);

        int n,q;
        cin>>n>>q;
        adjl.resize(n);
        int a,b,c,d;
        for( int i=0;i<n-1;i++ ){
            cin>>a>>b>>c>>d;
            a--;
            b--;
            adjl[a].pb( susjed( b,c,d ) );
            adjl[b].pb( susjed( a,c,d ) );
        }

        for( int i=0;i<n;i++ ){
                for( int j=0; (1<<j)<=n;j++ )
                    p[i][j] =-1;
            }
              dfs(0,0,0); /// dfs za lca
            for( int j=1;(1<<j)<=n;j++ ){
                for( int i=0;i<n;i++ ){
                    if( p[ p[i][j-1] ][j-1]!=-1 ) p[i][j] = p[ p[i][j-1] ][j-1];
                }
            }
           // cout << p[2][0] <<   " " << p[3][0] << " slicno  " <<endl;
        //    cout << lca( 2,3 ) << " oo " <<endl;
            for( int i=0;i<q;i++ ){
                cin >> c>>d>>a>>b;
                a--;
                b--;
           //     cout <<a << " " << b << " " <<lca( a,b ) << " maj "  <<endl;
                upd[a].pb( mp( i,0 ) );
                upd[b].pb( mp( i,0 ) );
                upd[ lca(a,b) ].pb( mp( i,1 ) );
                qlist[i] =  in( a,b,c,d ) ;
            }
           // cout << " masina " <<endl;
            dfs2( 0,0,0 );
            for( int i=0;i<q;i++ )
                cout<<res[i]<<endl;

      return 0;
    }





























Measured memory_bytes: 35832