Problem: In the Kingdom of IOI, the wind always blows from sea to land. There are $N + 1$ spots numbered from $0$ to $N$. The wind from Spot $0$ to Spot $N$ in order. Mr. JOI has a house at Spot $N$. The altitude of Spot $0$ is $A_0 = 0$, and the altitude of Spot $i$ ($1 \leq i \leq N$) is $A_i$.

The wind blows on the surface of the ground. The temperature of the wind changes according to the change of the altitude. The temperature of the wind at Spot $0$, which is closest to the sea, is $0$ degree. For each $i$ ($0 \leq i \leq N - 1$), the change of the temperature of the wind from Spot $i$ to Spot $i + 1$ depends only on the values of $A_i$ and $A_{i+1}$ in the following way:

* If $A_i < A_{i+1}$, the temperature of the wind decreases by $S$ degrees per altitude.
* If $A_i \geq A_{i+1}$, the temperature of the wind increases by $T$ degrees per altitude.



The tectonic movement is active in the land of the Kingdom of IOI. You have the data of tectonic movements for $Q$ days. In the $j$-th ($1 \leq j \leq Q$) day, the change of the altitude of Spot $k$ for $L_j \leq k \leq R_j$ ($1 \leq L_j \leq R_j \leq N$) is described by $X_j$. If $X_j$ is not negative, the altitude increases by $X_j$. If $X_j$ is negative, the altitude decreases by $|X_j|$.

Your task is to calculate the temperature of the wind at the house of Mr. JOI after each tectonic movement.

Task

Given the data of tectonic movements, write a program which calculates, for each $j$ ($1 \leq j \leq Q$), the temperature of the wind at the house of Mr. JOI after the tectonic movement on the $j$-th day.

Input

Read the following data from the standard input.

* The first line of input contains four space separated integers $N$, $Q$, $S$, $T$. This means there is a house of Mr. JOI at Spot $N$, there are $Q$ tectonic movements, the temperature of the wind decreases by $S$ degrees per altitude if the altitude increases, and the temperature of the wind increases by $T$ degrees per altitude if the altitude decreases.
* The $i$-th line ($1 \leq i \leq N +1$) of the following $N +1$ lines contains an integer $A_{i-1}$, which is the initial altitude at Spot ($i - 1$) before tectonic movements.
* The $j$-th line ($1 \leq j \leq Q$) of the following $Q$ lines contains three space separated integers $L_j$, $R_j$, $X_j$. This means, for the tectonic movement on the $j$-th day, the change of the altitude at the spots from $L_j$ to $R_j$ is described by $X_j$.



Output

Write $Q$ lines to the standard output. The $j$-th line ($1 \leq j \leq Q$) of output contains the temperature of the wind at the house of Mr. JOI after the tectonic movement on the $j$-th day.

Constraints

All input data satisfy the following conditions.

* $1 \leq N \leq 200 000．$
* $1 \leq Q \leq 200 000．$
* $1 \leq S \leq 1 000 000．$
* $1 \leq T \leq 1 000 000．$
* $A_0 = 0．$
* $-1 000 000 \leq A_i \leq 1 000 000 (1 \leq i \leq N)．$
* $1 \leq L_j \leq R_j \leq N (1 \leq j \leq Q)．$
* $ -1 000 000 \leq X_j \leq 1 000 000 (1 \leq j \leq Q)．$



Sample Input and Output

Sample Input 1


3 5 1 2
0
4
1
8
1 2 2
1 1 -2
2 3 5
1 2 -1
1 3 5


Sample Output 1


-5
-7
-13
-13
-18


Initially, the altitudes of the Spot 0, 1, 2, 3 are 0, 4, 1, 8, respectively. After the tectonic movement on the first day, the altitudes become 0, 6, 3, 8, respectively. At that moment, the temperatures of the wind are 0, -6, 0, -5,respectively.

Sample Input 2


2 2 5 5
0
6
-1
1 1 4
1 2 8


Sample Output 2


5
-35


Sample Input 3


7 8 8 13
0
4
-9
4
-2
3
10
-9
1 4 8
3 5 -2
3 3 9
1 7 4
3 5 -1
5 6 3
4 4 9
6 7 -10


Sample output 3


277
277
322
290
290
290
290
370





Creatie Commons License

The 16th Japanese Olympiad in Informatics (JOI 2016/2017) Final Round





Example

Input

3 5 1 2
0
4
1
8
1 2 2
1 1 -2
2 3 5
1 2 -1
1 3 5


Output

-5
-7
-13
-13
-18

Solution (in CPP):

Solution:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
 <url:https://www.ioi-jp.org/joi/2016/2017-ho/2017-ho.pdf>
 ?????????============================================================
 IOI ?????§??????????????????????????£??????????¢¨?????????????????????
 ?¢¨?????°??? 0 ????????°??? 1 ?????°??? 2,??? ??¨????????????????????????????????°??? N ?????§?????????
 ??°??? N ?????? JOI ????????¶???????????????????????????
 ??°??? 0 ????¨??????? A0=0 ??§???????????°??? i(1???i???N) ????¨??????? Ai ??§?????????
 
 ?¢¨?????°??¨??¢????????£????????????????????????????????????????¢¨???????????????????????????
 ????????\??????????????°??? 0 ??§????¢¨???????????? 0 ?????§????????????????????? i(0???i???N???1)???????????????
 ??°??? i ????????°??? i+1 ????????????????¢¨????????????????????????????????????????????? Ai ??¨ Ai+1 ??????????????????????????????
 ??\????????????????????£????????????
 
 Ai<Ai+1 ?????¨???????¨??????? 1 ??????????????¨????¢¨???????????? S ???????????????
 Ai??§Ai+1 ?????¨???????¨??????? 1 ??????????????¨????¢¨???????????? T ???????????????
 IOI ??????????????§?????°????????????????????§?????????
 ???????????????Q ??\????????°??????????????????????????\????????????
 j ??\???(1???j???Q) ?????????Lj???k???Rj(1???Lj???Rj???N) ??????????????°???????¨???? Ak ??? Xj ?????????????????????
 Xj ??????????????¨??????????¨??????? Xj????????????????????¨???????????????Xj ???????????¨??????????¨??????? |Xj| ????????????????????¨??????????????????
 
 ?????????????????????????????°????????????????????£????????????JOI ????????¶??????????¢¨?????????????±????????????¨??§?????????
 =================================================================
 ?§£??¬=============================================================
 0 -4 2 -5
 -2   +2
 0 -6 0 -5
 +2 -4
 
 ================================================================
 */

struct SegTree {
    int N;
    ll init_v = 0;
    vector<ll> node, lazy;
    
    SegTree(int _N) {
        N = 1;
        while (N < _N) N *= 2;
        node.resize(2 * N - 1, init_v);
        lazy.resize(2 * N - 1, init_v);
    }
    
    void lazy_evaluate(int k) {
        node[k] += lazy[k]; // add ???????????????
        if (k < N - 1) {
            lazy[2 * k + 1] += lazy[k] / 2; // add ???????????????
            lazy[2 * k + 2] += lazy[k] / 2;
        }
        lazy[k] = 0;
    }
    
    /* [a,b) ?????°??????????????¨???!! s~t?????§?????´??°???update(s,t+1,~) */
    ll update(int a, int b, ll x) { return update(a, b, 0, 0, N, x); }
    ll update(int a, int b, int k, int l, int r, ll x) {
        if (r <= a || b <= l) {
            lazy_evaluate(k); // node????????§???????????????????????´??°
            return node[k];
        }
        if (a <= l && r <= b) {
            lazy[k] += (r - l) * x; // ?????§?????????????????????????????¨???????????§????????°, ?????§?????????*????????????node??????????????????
            lazy_evaluate(k);
            return node[k];
        }
        else {
            lazy_evaluate(k);
            ll vl = update(a, b, 2 * k + 1, l, (l + r) / 2, x);
            ll vr = update(a, b, 2 * k + 2, (l + r) / 2, r, x);
            return node[k] = vl + vr;
        }
    }
    
    /* [a,b) ?????°??????????????¨???!! */
    ll query(int a, int b) { return query(a, b, 0, 0, N); }
    ll query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return init_v;
        if (a <= l && r <= b) {
            lazy_evaluate(k);
            return node[k];
        }
        else {
            lazy_evaluate(k);
            ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
            return vl + vr;
        }
    }
};

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N,Q,S,T; cin >> N >>Q >> S >> T;
    vector<ll> A(N+1);
    for(auto& a: A) cin >> a;
    SegTree rsq((int)N);
    for(int i = 0; i < N;i++){
        if(A[i] < A[i+1]){
            rsq.update(i,i+1,(A[i] - A[i+1])*S);
        }else{
            rsq.update(i,i+1,(A[i] - A[i+1])*T);
        }
    }
    for(int i = 0; i < Q;i++){
        ll l,r,x; cin >> l >> r >> x;
        ll L = rsq.query(l-1,l), R = rsq.query(r,r+1);
        
        ll newL = L/(L < 0? S:T) - x;
        ll newR = R/(R < 0? S:T) + x;
        rsq.update(l-1,l, -L + newL * (newL < 0 ? S:T));
        rsq.update(r,r+1, -R + newR * (newR < 0 ? S:T));
        cout << rsq.query(0,N) << endl;
    }
    return 0;
}