Problem: Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.

Today's training is to improve reflexes and memory by performing whac-a-mole many times. I want to hit the moles that come out one after another and get as many points as possible.

The places where moles may appear are lined up in a straight line, and the coordinates are determined by the distance from the reference point. As the rabbit continued his training for a while, he noticed that the place and time when the moles appeared were always the same. Rabbit decided to record all the information and analyze it with a computer.

In order to hit the mole, after moving the hand to the position where the mole appears, it is necessary to hit the mole exactly at the timing when the mole appears. If you hit the mole well, you can get points according to the mole. The action of hitting the mole can be done in an instant, but there is a limit to the speed at which the hand can be moved. Rabbits can use both their left and right hands to hit the moles. The left and right hands can be moved independently, but the left hand must always be in a position with smaller coordinates than the right hand. I would like to find out how many points can be obtained at the maximum under such conditions.



Input


NV X Left X Right
X1 T1 P1
...
XN TN PN


N is the number of moles that come out, V is the maximum speed at which the hand can be moved, and XLeft and XRight are the coordinates of the initial positions of the left and right hands, respectively. Xi, Ti, and Pi are the coordinates of the position where the mole appears, the time from the start of the game to the appearance, and the points obtained when hitting, respectively.

1 ≤ N ≤ 3,000, 1 ≤ V ≤ 10,000, 1 ≤ XLeft <XRight ≤ 100,000, 1 ≤ X1 ≤ X2 ≤ ... ≤ XN ≤ 100,000, 1 ≤ Ti ≤ 100,000, 1 ≤ Pi ≤ 100,000. The same set as (Xi, Ti) does not appear multiple times.

Output

Output the maximum point at which the rabbit can be obtained on one line.

Examples

Input

3 10 150 250
100 20 123
201 10 67
202 10 45


Output

190


Input

1 7 20 90
55 5 73


Output

73


Input

10 2 1000 2000
400 300 1
600 200 1
700 800 1
700 500 1
900 600 1
1000 700 1
1300 900 1
1400 400 1
1500 1000 1
2000 100 1


Output

10

Solution (in CPP):

Solution:
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct MinimumCostFlow {
	using Flow = int;
	using Cost = int;
	const Cost kInfCost = INF;
	struct Edge {
		int to, rev;
		Flow cap;
		Cost cost;
		Edge() {}
		Edge(int to, int rev, Flow cap, Cost cost) :to(to), rev(rev), cap(cap), cost(cost) {}
	};
	int n;
	vector<vector<Edge>> g;
	vector<Cost> dist;
	vector<int> prevv, preve;
	MinimumCostFlow(int n) :n(n), g(n), dist(n), prevv(n), preve(n) {}
	void addArc(int from, int to, Flow cap, Cost cost) {
		g[from].emplace_back(to, (int)g[to].size(), cap, cost);
		g[to].emplace_back(from, (int)g[from].size() - 1, Flow(), -cost);
	}
	// s??????t????????????f???????°??????¨???
	// ??????????????´?????? kInfCost
	Cost minimumCostFlow(int s, int t, Flow f) {
		Cost total = Cost();
		while (f > 0) {
			// Bellman-Ford
			fill(dist.begin(), dist.end(), kInfCost);
			dist[s] = 0;
			bool update = true;
			while (update) {
				update = false;
				for (int v = 0; v < n; v++) {
					if (dist[v] == kInfCost)continue;
					for (int i = 0; i < g[v].size(); i++) {
						Edge &e = g[v][i];
						if (e.cap > Flow() && dist[e.to] > dist[v] + e.cost) {
							dist[e.to] = dist[v] + e.cost;
							prevv[e.to] = v;
							preve[e.to] = i;
							update = true;
						}
					}
				}
			}
			// ????????\???????????????
			if (dist[t] == kInfCost)
				return kInfCost;
			// ?????????????????£??????????????????
			Flow d = f;
			for (int v = t; v != s; v = prevv[v])
				d = min(d, g[prevv[v]][preve[v]].cap);
			f -= d;
			total += dist[t] * d;
			for (int v = t; v != s; v = prevv[v]) {
				Edge &e = g[prevv[v]][preve[v]];
				e.cap -= d;
				g[v][e.rev].cap += d;
			}
		}
		return total;
	}
};

template<class T, class ...Tail>
void tiedSort(vector<T> &a, vector<Tail>&... tail) {
	int n = a.size();
	using S = tuple<T, Tail...>;
	vector<S> s(n);
	for (int i = 0; i < n; i++)
		s[i] = make_tuple(a[i], tail[i]...);
	sort(s.begin(), s.end());
	for (int i = 0; i < n; i++)
		tie(a[i], tail[i]...) = s[i];
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, V; cin >> N >> V;
	int L, R; cin >> L >> R;
	vector<int> X(N), T(N), P(N); rep(i, 0, N) {
		cin >> X[i] >> T[i] >> P[i];
	}
	tiedSort(T, X, P);
	MinimumCostFlow mcf(N + N + 4);
	int s = mcf.n - 4, t = s + 1, l = t + 1, r = l + 1;

	mcf.addArc(s, l, 1, 0);
	mcf.addArc(s, r, 1, 0);
	rep(i, 0, N) {
		if (abs(X[i] - L) <= T[i] * V)
			mcf.addArc(l, i, 1, 0);
		if (abs(X[i] - R) <= T[i] * V)
			mcf.addArc(r, i, 1, 0);
		mcf.addArc(i, i + N, 1, -P[i]);
		mcf.addArc(i, i + N, 1, 0);
		mcf.addArc(i + N, t, 2, 0);
	}
	vector<vector<bool>> exists(N, vector<bool>(N));
	rep(i, 0, N) {
		rep(j, i + 1, N) {
			if (abs(X[j] - X[i]) <= (T[j] - T[i])*V) {
				exists[i][j] = true;
			}
		}
	}
	rep(i, 0, N) {
		rrep(j, i + 2, N) {
			if (!exists[i][j])continue;
			rep(k, i + 1, j) {
				if (exists[i][k] && exists[k][j]) {
					exists[i][j] = false;
					break;
				}
			}
		}
	}

	rep(i, 0, N) {
		rep(j, i + 1, N) {
			if (exists[i][j])
				mcf.addArc(i + N, j, 2, 0);
		}
	}

	mcf.addArc(s, t, 2, 0);
	cout << -mcf.minimumCostFlow(s, t, 2) << endl;
	return 0;
}