#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

template<typename T>
struct SegmentTree {
	using value_type = T;
	using const_reference = const value_type &;
	using F = std::function<value_type(const_reference, const_reference)>;
	using size_type = std::size_t;
	
private:
	size_type n, n_;
	value_type id_elem;
	F f;
	std::vector<value_type> node;
	
public:
	SegmentTree(size_type n, const_reference id_elem, const F & f) : n(n), id_elem(id_elem), f(f) {
		n_ = 1;
		while (n_ < n) n_ <<= 1;
		node.resize(2 * n_, id_elem);
	}
	
	SegmentTree(std::vector<value_type> v, const_reference id_elem, const F & f) :
			SegmentTree(v.size(), id_elem, f) {
		for (size_type i = 0; i < v.size(); ++i) node[i + n_] = v[i];
		for (size_type i = n_ - 1; i > 0; --i) node[i] = f(node[i << 1], node[i << 1 | 1]);
	}
	
	size_type size() const noexcept {
		return n;
	}
	
	void set(size_type i, const_reference x) {
		assert(i < size());
		node[i += n_] = x;
		while (i > 1) {
			i >>= 1;
			node[i] = f(node[i << 1], node[i << 1 | 1]);
		}
	}
	
	const_reference get(size_type i) const {
		assert(i < size());
		return node[i + n_];
	}
	
	value_type fold(size_type l, size_type r) const {
		assert(l <= r);
		assert(r <= size());
		value_type lv = id_elem, rv = id_elem;
		for (l += n_, r += n_; l < r; l >>= 1, r >>= 1) {
			if (l & 1) lv = f(lv, node[l++]);
			if (r & 1) rv = f(node[r - 1], rv);
		}
		return f(lv, rv);
	}
	
	const_reference fold_all() const {
		return node[1];
	}
	
	size_type max_right(size_type l, std::function<bool(const_reference)> g) const {
		assert(l <= size());
		assert(g(id_elem));
		if (l == size()) return size();
		l += n_;
		value_type sum = id_elem;
		while (true) {
			while (~l & 1) l >>= 1;
			const value_type nex_sum = f(sum, node[l]);
			if (g(nex_sum)) { sum = nex_sum; ++l; }
			else break;
			if ((l & -l) == l) return size();
		}
		while (l < n_) {
			const value_type nex_sum = f(sum, node[l << 1]);
			l <<= 1;
			if (g(nex_sum)) { sum = nex_sum; l |= 1; }
		}
		return l - n_;
	}
	
	size_type min_left(size_type r, std::function<bool(const_reference)> g) const {
		assert(r <= size());
		assert(g(id_elem));
		if (r == 0) return 0;
		r += n_;
		value_type sum = id_elem;
		while (true) {
			--r;
			while (r > 1 && (r & 1)) r >>= 1;
			const value_type nex_sum = f(node[r], sum);
			if (g(nex_sum)) sum = nex_sum;
			else break;
			if ((r & -r) == r) return 0;
		}
		while (r < n_) {
			const value_type nex_sum = f(node[r << 1 | 1], sum);
			r <<= 1;
			if (!g(nex_sum)) r |= 1;
			else sum = nex_sum;
		}
		return r + 1 - n_;
	}
};

struct HeavyLightDecomposition {
	using size_type = std::uint_fast32_t;
	using Graph = std::vector<std::vector<size_type>>;
	
private:
	size_type bf_n; // 分解前の頂点数
	std::vector<size_type> roots; // 各木の根
	std::vector<size_type> par_; // 分解前の頂点 i の親頂点(頂点 i が根の場合は自分自身)
	std::vector<std::vector<size_type>> ver_info; // i 番目の heavy-path に含まれる分解前の頂点番号(index が後のものほど根側)
	std::vector<size_type> heavy_map_; // 分解後において、分解前の頂点 i が属する heavy-path
	std::vector<size_type> idx_map_; // 分解後において、分解前の頂点 i が属する heavy-path 内の index
	std::vector<size_type> tree_id_; // 分解前の頂点 i が属する木の番号
	std::vector<size_type> heavy_depth_; // [i] := heavy-path i の根からの深さ(0-indexed)
	std::vector<std::vector<size_type>> par_dblng_; // [k][i] := 分解前で heavy-path i から2^k 回 heavy-path を上ったとき、最初に到達する頂点番号
	
public:
	HeavyLightDecomposition(const Graph & g, bool use_lca = false) : bf_n(g.size()) {
		par_.assign(bf_size(), bf_size());
		heavy_map_.assign(bf_size(), bf_size());
		idx_map_.assign(bf_size(), bf_size());
		tree_id_.assign(bf_size(), bf_size());
		
		std::vector<size_type> sub_size(bf_size());
		size_type tree_cnt = 0;
		for (size_type i = 0; i < bf_size(); ++i) {
			if (tree_id_[i] != bf_size()) continue;
			std::stack<std::pair<size_type, size_type>> stk;
			stk.emplace(i, 0);
			par_[i] = i;
			tree_id_[i] = roots.size();
			
			while (!stk.empty()) {
				const size_type u = stk.top().first;
				const size_type j = stk.top().second;
				stk.pop();
				
				if (j < g[u].size()) {
					const size_type v = g[u][j];
					stk.emplace(u, j + 1);
					if (v == par_[u]) continue;
					par_[v] = u;
					tree_id_[v] = tree_cnt;
					stk.emplace(v, 0);
				}
				else {
					sub_size[u] = 1;
					size_type mx_size = 0, mx_idx = u;
					for (size_type v : g[u]) {
						if (v == par_[u]) continue;
						sub_size[u] += sub_size[v];
						if (mx_size < sub_size[v]) {
							mx_size = sub_size[v];
							mx_idx = v;
						}
					}
					if (sub_size[u] == 1) {
						heavy_map_[u] = ver_info.size();
						idx_map_[u] = 0;
						ver_info.emplace_back();
						heavy_depth_.emplace_back();
					}
					else {
						heavy_map_[u] = heavy_map_[mx_idx];
						idx_map_[u] = idx_map_[mx_idx] + 1;
					}
					ver_info[heavy_map_[mx_idx]].emplace_back(u);
				}
			}
			
			stk.emplace(i, 0);
			heavy_depth_[heavy_map_[i]] = 0;
			while (!stk.empty()) {
				const size_type u = stk.top().first;
				const size_type j = stk.top().second;
				stk.pop();
				if (j < g[u].size()) {
					stk.emplace(u, j + 1);
					const size_type v = g[u][j];
					if (v == par_[u]) continue;
					if (heavy_map_[u] != heavy_map_[v]) heavy_depth_[heavy_map_[v]] = heavy_depth_[heavy_map_[u]] + 1;
					stk.emplace(v, 0);
				}
			}
			roots.emplace_back(i);
		}
		sub_size.clear();
		
		if (!use_lca) return;
		size_type max_depth = *std::max_element(begin(heavy_depth_), end(heavy_depth_));
		size_type lglg_n = 0;
		while ((1 << lglg_n) < max_depth) ++lglg_n;
		
		par_dblng_.assign(lglg_n + 1, std::vector<size_type>(ver_info.size(), bf_size()));
		for (size_type i = 0; i < ver_info.size(); ++i) par_dblng_[0][i] = par_[ver_info[i].back()];
		
		for (size_type i = 0; i < lglg_n; ++i) {
			for (size_type j = 0; j < ver_info.size(); ++j) {
				par_dblng_[i + 1][j] = par_dblng_[i][heavy_map_[par_dblng_[i][j]]];
			}
		}
	}
	
	size_type bf_size() const noexcept { return bf_n; }
	size_type af_size() const noexcept { return ver_info.size(); }
	size_type heavy_size(size_type k) const { assert(k < af_size()); return ver_info[k].size(); }
	size_type tree_cnt() const noexcept { return roots.size(); }
	const std::vector<size_type> & trees() const noexcept { return roots; }
	const std::vector<size_type> & operator [](size_type k) const noexcept { return ver_info[k]; }
	size_type at(size_type i, size_type j) const {
		assert(i < af_size());
		assert(j < ver_info[i].size());
		return ver_info[i][j];
	}
	size_type par(size_type k) const { assert(k < bf_size()); return par_[k]; }
	size_type heavy_map(size_type k) const { assert(k < bf_size()); return heavy_map_[k]; }
	size_type idx_map(size_type k) const { assert(k < bf_size()); return idx_map_[k]; }
	size_type tree_id(size_type k) const { assert(k < bf_size()); return tree_id_[k]; }
	size_type heavy_depth(size_type k) const { assert(k < af_size()); return heavy_depth_[k]; }
	const std::vector<std::vector<size_type>> & par_dblng() const {
		assert(!par_dblng_.empty());
		return par_dblng_;
	}
	
	std::pair<size_type, size_type> get_lca_path(size_type x, size_type y) const {
		assert(!par_dblng_.empty());
		assert(x < bf_size());
		assert(y < bf_size());
		assert(tree_id_[x] == tree_id_[y]);
		if (heavy_map_[x] == heavy_map_[y]) return {x, y};
		
		bool isswap = heavy_depth_[heavy_map_[x]] < heavy_depth_[heavy_map_[y]];
		if (isswap) std::swap(x, y);
		
		const size_type diff = heavy_depth_[heavy_map_[x]] - heavy_depth_[heavy_map_[y]];
		for (size_type i = par_dblng_.size(); i > 0; --i) {
			if (diff >> (i - 1) & 1) x = par_dblng_[i - 1][heavy_map_[x]];
		}
		if (heavy_map_[x] == heavy_map_[y]) return isswap ? std::make_pair(y, x) : std::make_pair(x, y);
		
		for (size_type i = par_dblng_.size(); i > 0; --i) {
			const size_type p1 = par_dblng_[i - 1][heavy_map_[x]], p2 = par_dblng_[i - 1][heavy_map_[y]];
			if (heavy_map_[p1] != heavy_map_[p2]) x = p1, y = p2;
		}
		x = par_dblng_[0][heavy_map_[x]];
		y = par_dblng_[0][heavy_map_[y]];
		return isswap ? std::make_pair(y, x) : std::make_pair(x, y);
	}
	
	size_type get_lca(size_type x, size_type y) const {
		assert(!par_dblng_.empty());
		assert(x < bf_size());
		assert(y < bf_size());
		std::pair<size_type, size_type> res = get_lca_path(x, y);
		return ver_info[heavy_map_[res.first]][std::max(idx_map_[res.first], idx_map_[res.second])];
	}
};

template<class HLD, typename T, template<typename> class SEG>
struct HeavyLightDecomposition_PathQuery {
	using value_type = T;
	using const_reference = const value_type &;
	using seg_type = SEG<value_type>;
	using hld_type = HLD;
	using size_type = std::uint_fast32_t;
	using Graph = typename hld_type::Graph;
	using F = std::function<value_type(const_reference, const_reference)>;
	
private:
	value_type id_elem;
	F f;
	hld_type hld;
	std::vector<seg_type> seg, rseg;
	bool value_on_vertex;
	
public:
	HeavyLightDecomposition_PathQuery(const Graph & g, const value_type & id_elem, const F & f, bool value_on_vertex)
		: id_elem(id_elem), f(f), hld(g), value_on_vertex(value_on_vertex) {
		seg.reserve(hld.af_size());
		rseg.reserve(hld.af_size());
		for (size_type i = 0; i < hld.af_size(); ++i) {
			seg.emplace_back(hld.heavy_size(i), id_elem, f);
			rseg.emplace_back(hld.heavy_size(i), id_elem, f);
		}
	}
	
	HeavyLightDecomposition_PathQuery(const Graph & g, const std::vector<value_type> & v, const value_type & id_elem, const F & f)
		: id_elem(id_elem), f(f), hld(g), value_on_vertex(true) {
		seg.reserve(hld.af_size());
		rseg.reserve(hld.af_size());
		for (size_type i = 0; i < hld.af_size(); ++i) {
			std::vector<value_type> init;
			init.reserve(hld.heavy_size(i));
			for (size_type j = 0; j < hld.heavy_size(i); ++j) init.emplace_back(v[hld[i][j]]);
			seg.emplace_back(init, id_elem, f);
			std::reverse(begin(init), end(init));
			rseg.emplace_back(init, id_elem, f);
		}
	}
	
	const hld_type & get_hld() const {
		return hld;
	}
	
	void set(size_type k, const_reference x) {
		assert(value_on_vertex);
		assert(k < hld.bf_size());
		set_(k, x);
	}
	
	void set(size_type u, size_type v, const_reference x) {
		assert(!value_on_vertex);
		assert(u < hld.bf_size());
		assert(v < hld.bf_size());
		assert(hld.par(u) == v || hld.par(v) == u);
		set_(hld.par(u) == v ? u : v, x);
	}
	
	value_type get(size_type k) const {
		assert(value_on_vertex);
		assert(k < hld.bf_size());
		return seg[hld.heavy_map(k)].get(hld.idx_map(k));
	}
	
	value_type get(size_type u, size_type v) const {
		assert(!value_on_vertex);
		assert(u < hld.bf_size());
		assert(v < hld.bf_size());
		assert(hld.par(u) == v || hld.par(v) == u);
		return get_(hld.par(u) == v ? u : v);
	}
	
private:
	void set_(size_type k, const_reference x) {
		const size_type heavy_id = hld.heavy_map(k);
		const size_type heavy_idx = hld.idx_map(k);
		seg[heavy_id].set(heavy_idx, x);
		rseg[heavy_id].set(hld.heavy_size(heavy_id) - 1 - heavy_idx, x);
	}
	
	value_type get_(size_type k) const {
		return seg[hld.heavy_map(k)].get(hld.idx_map(k));
	}
	
public:
	value_type fold(size_type u, size_type v) const {
		assert(u < hld.bf_size());
		assert(v < hld.bf_size());
		assert(hld.tree_id(u) == hld.tree_id(v));
		value_type lv = id_elem, rv = id_elem;
		
		while (hld.heavy_map(u) != hld.heavy_map(v)) {
			if (hld.heavy_depth(hld.heavy_map(u)) >= hld.heavy_depth(hld.heavy_map(v))) {
				const size_type heavy_id = hld.heavy_map(u);
				const size_type heavy_size = hld.heavy_size(heavy_id);
				lv = f(lv, seg[heavy_id].fold(hld.idx_map(u), heavy_size));
				u = hld.par(hld[heavy_id][heavy_size - 1]);
			}
			if (hld.heavy_map(u) == hld.heavy_map(v)) break;
			if (hld.heavy_depth(hld.heavy_map(u)) <= hld.heavy_depth(hld.heavy_map(v))) {
				const size_type heavy_id = hld.heavy_map(v);
				const size_type heavy_size = hld.heavy_size(heavy_id);
				rv = f(rseg[heavy_id].fold(0, heavy_size - hld.idx_map(v)), rv);
				v = hld.par(hld[heavy_id][heavy_size - 1]);
			}
		}
		
		const size_type heavy_id = hld.heavy_map(u);
		if (hld.idx_map(u) < hld.idx_map(v)) lv = f(lv, seg[heavy_id].fold(hld.idx_map(u), hld.idx_map(v) + value_on_vertex));
		else rv = f(rseg[heavy_id].fold(hld.heavy_size(heavy_id) - hld.idx_map(u) - value_on_vertex, hld.heavy_size(heavy_id) - hld.idx_map(v)), rv);
		return f(lv, rv);
	}
};

int main() {
	int N, Q;
	cin >> N >> Q;
	vector<vector<std::uint_fast32_t>> g(N);
	vector<int> A(N - 1), B(N - 1), C(N - 1), D(N - 1);
	vector<vector<int>> colv(N - 1);
	
	REP(i, N - 1) {
		scanf("%d %d %d %d", &A[i], &B[i], &C[i], &D[i]);
		--A[i]; --B[i]; --C[i];
		g[A[i]].emplace_back(B[i]);
		g[B[i]].emplace_back(A[i]);
		colv[C[i]].emplace_back(i);
	}
	
	vector<int> X(Q), Y(Q), U(Q), V(Q);
	REP(i, Q) {
		scanf("%d %d %d %d", &X[i], &Y[i], &U[i], &V[i]);
		--X[i]; --U[i]; --V[i];
	}
	
	vector<int> ord(Q), ans(Q);
	iota(ALL(ord), 0);
	sort(ALL(ord), [&](int x, int y) {
		return X[x] < X[y];
	});
	
	HeavyLightDecomposition_PathQuery<HeavyLightDecomposition, int, SegmentTree> hld1(g, 0, [](int a, int b) { return a + b; }, false);
	REP(i, N - 1) hld1.set(A[i], B[i], D[i]);
	HeavyLightDecomposition_PathQuery<HeavyLightDecomposition, pii, SegmentTree> hld2(g, {0, 0}, [](const pii & x, const pii & y) -> pii {
		return {x.fi + y.fi, x.se + y.se};
	}, false);
	
	REP(t, Q) {
		int i = ord[t];
		if (t == 0 || X[ord[t]] != X[ord[t - 1]])
			for (int cur : colv[X[i]]) hld2.set(A[cur], B[cur], {D[cur], 1});
		
		ans[i] = hld1.fold(U[i], V[i]);
		pii fr = hld2.fold(U[i], V[i]);
		ans[i] -= fr.fi;
		ans[i] += fr.se * Y[i];
		
		if (t + 1 < Q && X[ord[t]] != X[ord[t + 1]])
			for (int cur : colv[X[i]]) hld2.set(A[cur], B[cur], {0, 0});
	}
	
	REP(i, Q) printf("%d\n", ans[i]);
	
	return 0;
}


Measured memory_bytes: 79696