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>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

struct Edge{
    Edge(const short to,const short reverse,const char capacity,const int cost,bool is_reverse = false):to{to},reverse{reverse},capacity{capacity},flow{0},cost{cost},is_reverse{is_reverse}{}
    short to;
    short reverse;
    char capacity;
    char flow;
    int cost;
    bool is_reverse;
};

class tsort {
public:
	vector<int> deg;
    vector<short> order;
	short V;
	tsort(const vector<vector<Edge>>& g)
    {
		V = len(g);
		deg.resize(V,0);
        rep(i,len(g)){
            for(const Edge& e : g[i]){
                if(!e.is_reverse){
                    deg[e.to]++;
                }
            }
        }
        make(g);
	}
	void make(const vector<vector<Edge>>& G) {
		queue<short> que;
		rep(i,V){
	        if(deg[i] == 0){
	            que.push(i);
	        }
	    }
		while(!que.empty()){
			short p = que.front();
	        que.pop();
			order.push_back(p);
			rep(i,G[p].size()){
	            if(--deg[G[p][i].to] == 0){
	                que.push(G[p][i].to);
	            }
	        }
		}
	}
};

class CostFlow
{
public:
    using T = int;

    CostFlow(const short v):V{v}
    {
        edge.resize(v);
        m_dist.resize(v);
        m_potential.resize(v);
        m_prev_v.resize(v);
        m_prev_e.resize(v);
    }

    void addEdge(const short from, const short to, const char capacity,const T cost)
    {
        edge[from].pb(Edge{to,(short)edge[to].size(),capacity,cost,false});
        edge[to].pb(Edge{from,(short)(edge[from].size()-1),0,-cost,true});
    }

    T minCostFlow(const short s,const short t, char f)
    {
    //    const T INF = numeric_limits<T>::max()/100;
        using P = pair<T,short>;
        T res = 0;
        fill(all(m_potential),0);
        tsort ts(edge);
// potential
        for(short i =0; i < V; i++){
            m_potential[i] = INF;
        }
        m_potential[s] = 0;
//        assert(s == order[0]);
    //    svec(order);

        for(const short i:ts.order){
            if(m_potential[i] != INF){
                for(const auto& e: edge[i]){
                    if(e.is_reverse){
                        continue;
                    }
                    m_potential[e.to] = min(m_potential[e.to],m_potential[i]+e.cost);
                }
            }
        }

//        svec(m_potential);

        while(f > 0)
        {
            priority_queue<P,vector<P>,greater<P>> q;
            fill(all(m_dist),INF);
            m_dist[s]=0;
            q.push(make_pair(0,s));
            while(not q.empty()){
                const P p = q.top();
                q.pop();
                const short v = p.second;
                if(m_dist[v] < p.first){
                    continue;
                }
                for(short i = 0; i < edge[v].size();i++){
                    const auto& e = edge[v][i];
                    if(e.capacity > e.flow and m_dist[e.to] > m_dist[v]+e.cost+m_potential[v]-m_potential[e.to]){
                        m_dist[e.to] = m_dist[v]+e.cost+m_potential[v]-m_potential[e.to];
                        m_prev_v[e.to] = v;
                        m_prev_e[e.to] = i;
                        q.push(make_pair(m_dist[e.to],e.to));
                    }
                }
            }

            if(m_dist[t] == INF){
                return -1;
            }
            for(short v = 0; v < V; v++){
                m_potential[v] += m_dist[v];
            }
            char d = f;
            for(short v = t; v != s; v = m_prev_v[v]){
                const auto& e = edge[m_prev_v[v]][m_prev_e[v]];
                d = min(d,(char)(e.capacity-e.flow));
            }
            f-= d;
            res += d*m_potential[t];
            for(short v = t; v != s;v=m_prev_v[v]){
                auto& e = edge[m_prev_v[v]][m_prev_e[v]];
                e.flow += d;
                edge[v][e.reverse].flow-=d;
            }
        }
        return res;
    }

    const short V;
    vector<vector<Edge>> edge;
private:
    vector<T> m_dist;
    vector<T> m_potential;
    vector<short> m_prev_v;
    vector<short> m_prev_e;
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,v,xr,xl;
    cin >> n >> v >> xr >> xl;
    vvl vec(n,vl(3));
    rep(i,n){
        rep(j,3){
            cin >> vec[i][j];
        }
    }
    CostFlow mc(2*n+4);
    rep(i,n){
        mc.addEdge(i,n+i,1,0);
    }
    rep(i,2){
        mc.addEdge(2*n,2*n+1+i,1,0);
    }
    rep(i,n){
        if(abs(xl-vec[i][0]) <= v*vec[i][1]){
            mc.addEdge(2*n+1,i,1,0);
        }
    }
    rep(i,n){
        if(abs(xr-vec[i][0]) <= v*vec[i][1]){
            mc.addEdge(2*n+2,i,1,0);
        }
    }
    rep(i,n){
        rep(j,n){
            if(i != j){
                if(abs(vec[i][0]-vec[j][0]) <= v*(vec[j][1]-vec[i][1])){
                    mc.addEdge(n+i,j,1,-vec[i][2]);
                }
            }
        }
    }
    rep(i,n){
        mc.addEdge(n+i,2*n+3,1,-vec[i][2]);
    }
    rep(i,2){
        mc.addEdge(2*n+1+i,2*n+3,1,0);
    }
    cout << -mc.minCostFlow(2*n,2*n+3,2) << "\n";
    return 0;
}