Foehn Phenomena

After each range add to altitudes, report the wind temperature at spot N, where the total depends on the altitude differences between adjacent spots.

Medium6ArrayPrefix sumImplementationInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

In the Kingdom of IOI, the wind always blows from the sea toward the land. There are N+1N + 1 spots, numbered from 0 to NN. The wind blows from Spot 0 to Spot NN in order of their numbers. Mr. JOI has a house at Spot NN. The altitude of Spot 0 is A0=0A_0 = 0, and the altitude of Spot ii (1iN1 \le i \le N) is AiA_i.

The wind blows along the surface of the ground, and its temperature changes as the altitude changes. At Spot 0, which is closest to the sea, the temperature of the wind is 0 degrees. For each ii (0iN10 \le i \le N - 1), the change in the temperature of the wind from Spot ii to Spot i+1i + 1 depends only on AiA_i and Ai+1A_{i+1}, as follows.

  • If Ai<Ai+1A_i < A_{i+1}, the temperature of the wind decreases by SS degrees per unit of altitude, that is, by S×(Ai+1Ai)S \times (A_{i+1} - A_i) degrees.
  • If AiAi+1A_i \ge A_{i+1}, the temperature of the wind increases by TT degrees per unit of altitude, that is, by T×(AiAi+1)T \times (A_i - A_{i+1}) degrees.

Tectonic movement is active in the land of the Kingdom of IOI. You are given the record of tectonic movements over QQ days. On day jj (1jQ1 \le j \le Q), the altitude of every Spot kk with LjkRjL_j \le k \le R_j changes by XjX_j (1LjRjN1 \le L_j \le R_j \le N). If XjX_j is not negative, the altitude increases by XjX_j. If XjX_j is negative, the altitude decreases by Xj|X_j|. Each tectonic movement applies to the altitudes left by the movements of the previous days.

Given the record of tectonic movements, write a program that computes, for each jj (1jQ1 \le j \le Q), the temperature of the wind at Mr. JOI's house right after the tectonic movement on day jj.

Input

The first line contains four space-separated integers NN, QQ, SS, and TT. Mr. JOI's house is at Spot NN, and there are QQ tectonic movements. When the altitude rises, the temperature of the wind decreases by SS degrees per unit of altitude. When the altitude falls, it increases by TT degrees per unit of altitude.

The ii-th of the next N+1N + 1 lines (1iN+11 \le i \le N + 1) contains an integer Ai1A_{i-1}, the altitude of Spot (i1)(i - 1) before any tectonic movement.

The jj-th of the next QQ lines (1jQ1 \le j \le Q) contains three space-separated integers LjL_j, RjR_j, and XjX_j. They mean that on day jj the altitude of the spots from LjL_j to RjR_j changes by XjX_j.

Output

Print QQ lines. The jj-th line (1jQ1 \le j \le Q) contains the temperature of the wind at Mr. JOI's house right after the tectonic movement on day jj.

Constraints

  • 1N2000001 \le N \le 200\,000
  • 1Q2000001 \le Q \le 200\,000
  • 1S10000001 \le S \le 1\,000\,000
  • 1T10000001 \le T \le 1\,000\,000
  • A0=0A_0 = 0
  • 1000000Ai1000000-1\,000\,000 \le A_i \le 1\,000\,000 (1iN1 \le i \le N)
  • 1LjRjN1 \le L_j \le R_j \le N (1jQ1 \le j \le Q)
  • 1000000Xj1000000-1\,000\,000 \le X_j \le 1\,000\,000 (1jQ1 \le j \le Q)
  • All input values are integers.