Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are _n_ available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so each fountain cost can be either in coins or diamonds. No money changes between the types are allowed.
Help Arkady to find two fountains with maximum total beauty so that he can buy both at the same time.
## Input
The first line contains three integers _n_, _c_ and _d_ (2 ≤ _n_ ≤ 100 000, 0 ≤ _c_, _d_ ≤ 100 000) — the number of fountains, the number of coins and diamonds Arkady has.
The next _n_ lines describe fountains. Each of these lines contain two integers _b__i_ and _p__i_ (1 ≤ _b__i_, _p__i_ ≤ 100 000) — the beauty and the cost of the _i_\-th fountain, and then a letter "_C_" or "_D_", describing in which type of money is the cost of fountain _i_: in coins or in diamonds, respectively.
## Output
Print the maximum total beauty of exactly two fountains Arkady can build. If he can't build two fountains, print _0_.
[samples]
## Note
In the first example Arkady should build the second fountain with beauty 4, which costs 3 coins. The first fountain he can't build because he don't have enough coins. Also Arkady should build the third fountain with beauty 5 which costs 6 diamonds. Thus the total beauty of built fountains is 9.
In the second example there are two fountains, but Arkady can't build both of them, because he needs 5 coins for the first fountain, and Arkady has only 4 coins.
Arkady 经常玩《Gardenscapes》。Arkady 想建造两个新的喷泉。目前有 #cf_span[n] 个可用的喷泉,每个喷泉都有其美丽值和价格。游戏中有两种货币:硬币和钻石,因此每个喷泉的价格要么是硬币,要么是钻石。不允许在两种货币之间进行兑换。
帮助 Arkady 找到两个喷泉,使得它们的总美丽值最大,且他能同时购买这两个喷泉。
第一行包含三个整数 #cf_span[n]、#cf_span[c] 和 #cf_span[d](#cf_span[2 ≤ n ≤ 100 000],#cf_span[0 ≤ c, d ≤ 100 000])——喷泉的数量,以及 Arkady 拥有的硬币和钻石数量。
接下来的 #cf_span[n] 行描述喷泉。每行包含两个整数 #cf_span[bi] 和 #cf_span[pi](#cf_span[1 ≤ bi, pi ≤ 100 000])——第 #cf_span[i] 个喷泉的美丽值和价格,然后是一个字母 "_C_" 或 "_D_",表示该喷泉的价格所使用的货币类型:硬币或钻石。
请输出 Arkady 能够建造的恰好两个喷泉的最大总美丽值。如果他无法建造两个喷泉,请输出 _0_。
在第一个例子中,Arkady 应该建造第二个喷泉,其美丽值为 #cf_span[4],价格为 #cf_span[3] 枚硬币。第一个喷泉他无法建造,因为他没有足够的硬币。同时,Arkady 应该建造第三个喷泉,其美丽值为 #cf_span[5],价格为 #cf_span[6] 颗钻石。因此,所建喷泉的总美丽值为 #cf_span[9]。
在第二个例子中,有两个喷泉,但 Arkady 无法同时建造它们,因为第一个喷泉需要 #cf_span[5] 枚硬币,而 Arkady 只有 #cf_span[4] 枚硬币。
## Input
第一行包含三个整数 #cf_span[n]、#cf_span[c] 和 #cf_span[d](#cf_span[2 ≤ n ≤ 100 000],#cf_span[0 ≤ c, d ≤ 100 000])——喷泉的数量,以及 Arkady 拥有的硬币和钻石数量。接下来的 #cf_span[n] 行描述喷泉。每行包含两个整数 #cf_span[bi] 和 #cf_span[pi](#cf_span[1 ≤ bi, pi ≤ 100 000])——第 #cf_span[i] 个喷泉的美丽值和价格,然后是一个字母 "_C_" 或 "_D_",表示该喷泉的价格所使用的货币类型:硬币或钻石。
## Output
请输出 Arkady 能够建造的恰好两个喷泉的最大总美丽值。如果他无法建造两个喷泉,请输出 _0_。
[samples]
## Note
在第一个例子中,Arkady 应该建造第二个喷泉,其美丽值为 #cf_span[4],价格为 #cf_span[3] 枚硬币。第一个喷泉他无法建造,因为他没有足够的硬币。同时,Arkady 应该建造第三个喷泉,其美丽值为 #cf_span[5],价格为 #cf_span[6] 颗钻石。因此,所建喷泉的总美丽值为 #cf_span[9]。在第二个例子中,有两个喷泉,但 Arkady 无法同时建造它们,因为第一个喷泉需要 #cf_span[5] 枚硬币,而 Arkady 只有 #cf_span[4] 枚硬币。
**Definitions**
Let $ n \in \mathbb{Z}^+ $ be the number of fountains, $ c, d \in \mathbb{Z}_{\geq 0} $ the available coins and diamonds.
Let $ F = \{ (b_i, p_i, t_i) \mid i \in \{1, \dots, n\} \} $ be the set of fountains, where:
- $ b_i \in \mathbb{Z}^+ $ is the beauty,
- $ p_i \in \mathbb{Z}^+ $ is the cost,
- $ t_i \in \{C, D\} $ is the currency type.
Partition $ F $ into:
- $ F_C = \{ (b_i, p_i) \mid t_i = C \} $: fountains costing coins,
- $ F_D = \{ (b_i, p_i) \mid t_i = D \} $: fountains costing diamonds.
**Constraints**
1. $ 2 \leq n \leq 100{,}000 $
2. $ 0 \leq c, d \leq 100{,}000 $
3. $ 1 \leq b_i, p_i \leq 100{,}000 $ for all $ i $
**Objective**
Find the maximum total beauty $ b_i + b_j $ over all distinct pairs $ (i, j) $ such that:
- Either $ (b_i, p_i) \in F_C $, $ (b_j, p_j) \in F_D $, and $ p_i \leq c $, $ p_j \leq d $,
- Or $ (b_i, p_i), (b_j, p_j) \in F_C $, $ i \ne j $, and $ p_i + p_j \leq c $,
- Or $ (b_i, p_i), (b_j, p_j) \in F_D $, $ i \ne j $, and $ p_i + p_j \leq d $.
If no such pair exists, output $ 0 $.