//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline bool isPower2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll getMaxEffectiveBit(ull a)
{
	ll index = -1;
	for (; a != 0; a >>= 1)
	{
		++index;
	}
return index;
}

inline ll getSpecifiedBit(ull a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull getGcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

template<class Integer>
inline Integer getPower(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

ll getLCA(ll node1, ll node2, const vector<vector<ll>>& parentNodes, const vector<ll>& depths) {
	if (depths[node1] > depths[node2])
	{
		auto diff = depths[node1] - depths[node2];
		while (diff > 0)
		{
			node1 = parentNodes[node1][getMaxEffectiveBit(diff & -diff)];
			diff -= diff & -diff;
		}
	}
	else if (depths[node1] < depths[node2])
	{
		auto diff = depths[node2] - depths[node1];
		while (diff > 0)
		{
			node2 = parentNodes[node2][getMaxEffectiveBit(diff & -diff)];
			diff -= diff & -diff;
		}
	}

	if (node1 == node2)
	{
		return node1;
	}

	const ll sz = parentNodes[node1].size();
	for (ll i = 0; i < sz; ++i)
	{
		if (parentNodes[node1][sz - i - 1] != parentNodes[node2][sz - i - 1])
		{
			node1 = parentNodes[node1][sz - i - 1];
			node2 = parentNodes[node2][sz - i - 1];
		}
	}

	return parentNodes[node1][0];
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, Q;
	cin >> N >> Q;

	vector<vector<tuple<ll, ll, ll>>> edges(N);
	ll a, b, c, d;
	for (ll i = 0; i < N - 1; ++i)
	{
		cin >> a >> b >> c >> d;
		--a, --b;
		edges[a].emplace_back(b, c, d);
		edges[b].emplace_back(a, c, d);
	}

	vector<ll> depths(N);
	vector<ll> dists(N);
	ll logN = getMaxEffectiveBit(N) + 1;
	vector<vector<ll>> parentNodes(N, vector<ll>(logN + 1));

	{
		vector<bool> haveChecked(N, false);
		stack<ll> searchNodes;

		searchNodes.emplace(0);
		depths[0] = 0;
		dists[0] = 0;
		haveChecked[0] = true;

		ll endNode, color, length;
		while (!searchNodes.empty())
		{
			ll startNode = searchNodes.top();
			searchNodes.pop();

			for (auto edge : edges[startNode])
			{
				tie(endNode, color, length) = edge;
				if (haveChecked[endNode])
				{
					continue;
				}

				depths[endNode] = depths[startNode] + 1;
				dists[endNode] = dists[startNode] + length;

				parentNodes[endNode][0] = startNode;
				for (ll i = 0; i < logN; ++i)
				{
					parentNodes[endNode][i + 1] = parentNodes[parentNodes[endNode][i]][i];
				}

				searchNodes.push(endNode);
				haveChecked[endNode] = true;
			}
		}
	}

	map<ll, ll> nodeToPassCount;
	map<pair<ll, ll>, pair<ll, ll>> colorMap;

	{
		ll passCount = 0;
		vector<ll> colorCount(N);
		vector<ll> colorDist(N);

		stack<tuple<ll, ll, ll, ll>> searchEdges;

		ll startNode, endNode, color, length;
		startNode = 0;
		for (auto edge : edges[startNode])
		{
			tie(endNode, color, length) = edge;
			searchEdges.emplace(startNode, endNode, color, length);
		}
		nodeToPassCount[0] = passCount++;

		while (!searchEdges.empty())
		{
			tie(startNode, endNode, color, length) = searchEdges.top();;

			++colorCount[color];
			colorDist[color] += length;

			colorMap[make_pair(color, passCount)] = make_pair(colorCount[color], colorDist[color]);

			nodeToPassCount[endNode] = passCount++;

			for (auto edge : edges[endNode])
			{
				ll nextNode;
				tie(nextNode, color, length) = edge;
				if (nextNode == startNode)
				{
					continue;
				}
				searchEdges.emplace(endNode, nextNode, color, length);
			}

			if (edges[endNode].size() == 1)
			{
				ll prevNode, _;
				do {
					tie(prevNode, _, color, length) = searchEdges.top();
					searchEdges.pop();

					--colorCount[color];
					colorDist[color] -= length;

					colorMap[make_pair(color, passCount)] = make_pair(colorCount[color], colorDist[color]);
					
					++passCount;
				}
				while ( !searchEdges.empty() && prevNode != get<0>(searchEdges.top()) );
			}
		}
	}

	ll x, y, u, v, w;
	vector<tuple<ll, ll, ll, ll, ll>> queries;
	queries.reserve(Q);
	for (ll i = 0; i < Q; ++i)
	{
		cin >> x >> y >> u >> v;
		--u, --v;
		w = getLCA(u, v, parentNodes, depths);
		queries.emplace_back(x, y, u, v, w);
	}

	for (ll i = 0; i < Q; ++i)
	{
		tie(x, y, u, v, w) = queries[i];

		auto dist = dists[u] + dists[v] - dists[w] * 2;

		ll passCount;
		decltype(colorMap.begin()) iter;
		{
			passCount = nodeToPassCount[u];
			iter = colorMap.upper_bound(make_pair(x, passCount));
			if (iter != colorMap.begin() && (--iter)->first.first == x)
			{
				dist += iter->second.first * y - iter->second.second;
			}

			passCount = nodeToPassCount[v];
			iter = colorMap.upper_bound(make_pair(x, passCount));
			if (iter != colorMap.begin() && (--iter)->first.first == x)
			{
				dist += iter->second.first * y - iter->second.second;
			}

			passCount = nodeToPassCount[w];
			iter = colorMap.upper_bound(make_pair(x, passCount));
			if (iter != colorMap.begin() && (--iter)->first.first == x)
			{
				dist -= (iter->second.first * y - iter->second.second) * 2;
			}
		}

		cout << dist << endl;
	}

	return 0;
}


Measured memory_bytes: 55776