Problem: Little W and Little P decided to send letters to each other regarding the most important events during a day. There are n events during a day: at time moment t_i something happens to the person p_i (p_i is either W or P, denoting Little W and Little P, respectively), so he needs to immediately send a letter to the other person. They can send a letter using one of the two ways:

  * Ask Friendly O to deliver the letter directly. Friendly O takes d acorns for each letter.
  * Leave the letter at Wise R's den. Wise R values free space, so he takes c ⋅ T acorns for storing a letter for a time segment of length T. The recipient can take a letter from Wise R either when he leaves his own letter at Wise R's den, or at time moment t_{n + 1}, when everybody comes to Wise R for a tea. It is not possible to take a letter from Wise R's den at other time moments. The friends can store as many letters at Wise R's den as they want, paying for each one separately. 



Help the friends determine the minimum possible total cost of sending all letters.

Input

The first line contains three integers n, c, d (1 ≤ n ≤ 10^5, 1 ≤ c ≤ 10^2, 1 ≤ d ≤ 10^8) — the number of letters, the cost of storing a letter for one time unit at Wise R's den and the cost of delivering a letter via Friendly O.

The next n describe the events. The i-th of them contains an integer t_i and a character p_i (0 ≤ t_i ≤ 10^6, p_i is either W or P) — the time the i-th event happens and the person the event happens to.

The last line contains a single integer t_{n + 1} (0 ≤ t_{n+1} ≤ 10^6) — the time when everybody comes to Wise R for a tea and takes all remaining letters. 

It is guaranteed that t_i < t_{i + 1} for all i from 1 to n.

Output

Print a single integer — the minimum possible cost of delivery of all letters.

Examples

Input


5 1 4
0 P
1 W
3 P
5 P
8 P
10


Output


16


Input


10 10 94
17 W
20 W
28 W
48 W
51 P
52 W
56 W
62 P
75 P
78 P
87


Output


916

Note

One of optimal solutions in the first example:

  * At time moment 0 Little P leaves the letter at Wise R's den.
  * At time moment 1 Little W leaves his letter at Wise R's den and takes Little P's letter. This letter is at the den from time moment 0 to time moment 1, it costs 1 acorn.
  * At time moment 3 Little P sends his letter via Friendly O, it costs 4 acorns.
  * At time moment 5 Little P leaves his letter at the den, receiving Little W's letter which storage costs 4 acorns.
  * At time moment 8 Little P leaves one more letter at the den.
  * At time moment 10 Little W comes to the den for a tea and receives the two letters, paying 5 and 2 acorns.



The total cost of delivery is thus 1 + 4 + 4 + 5 + 2 = 16 acorns.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(long long a) {
  write(a);
  puts("");
}
inline void wri(long long a) {
  write(a);
  putchar(' ');
}
const int N = 100005;
long long t[N], p[N], dp[N], s[2][N], S[2][N];
bool cha(pair<long long, long long> a, pair<long long, long long> b,
         pair<long long, long long> c) {
  return (b.second - a.second) * (c.first - b.first) >=
         (c.second - b.second) * (b.first - a.first);
}
long long get(pair<long long, long long> a, long long x) {
  return a.first * x + a.second;
}
struct convex {
  int l, r;
  pair<long long, long long> q[N];
  void push(pair<long long, long long> x) {
    while (l < r && cha(q[r - 1], q[r], x)) r--;
    q[++r] = x;
  }
  long long ask(long long pos) {
    while (l < r && get(q[l], pos) >= get(q[l + 1], pos)) l++;
    return get(q[l], pos);
  }
} q[2];
int main() {
  int n = read();
  long long c = read(), d = read();
  q[0].l = q[1].l = 1;
  q[0].push(make_pair(0, 0));
  q[1].push(make_pair(0, 0));
  for (int i = 1; i <= n; i++) {
    t[i] = read() * c;
    p[i] = getchar() == 'W';
    for (int j = 0; j < 2; j++) {
      s[j][i] = s[j][i - 1];
      S[j][i] = S[j][i - 1];
    }
    s[p[i]][i]++;
    S[p[i]][i] += t[i];
    dp[i] = min(min((i - 1) * d, dp[i - 1] + d + t[i] - t[i - 1]),
                q[p[i] ^ 1].ask(-t[i]) + s[p[i] ^ 1][i] * t[i] -
                    S[p[i] ^ 1][i] + s[p[i]][i - 1] * d);
    q[p[i]].push(make_pair(s[p[i]][i - 1],
                           dp[i] + S[p[i]][i - 1] - s[p[i] ^ 1][i - 1] * d));
  }
  t[n + 1] = read() * c;
  long long ans = dp[n] + d + t[n + 1] - t[n];
  for (int i = 0; i < 2; i++)
    ans = min(ans, q[i].ask(-t[n + 1]) + s[i][n] * t[n + 1] - S[i][n] +
                       s[i ^ 1][n] * d);
  cout << min(n * d, ans) << endl;
}