#abc362a. A - Buy a Pen

A - Buy a Pen

Score : 100100 points

问题陈述

高桥来到一家商店买笔。在这里,一支红色笔的价格是R日元,一支绿色笔的价格是G日元,一支蓝色笔的价格是B日元。

高桥不喜欢颜色C。如果C是红色,他就不能买红色笔;如果C是绿色,他就不能买绿色笔;如果C是蓝色,他就不能买蓝色笔。

确定他买一支笔所需的最少金额。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

Takahashi came to a store to buy a pen. Here, a red pen costs RR yen, a green pen costs GG yen, and a blue pen costs BB yen.

Takahashi dislikes the color CC. If CC is Red, he cannot buy a red pen; if CC is Green, he cannot buy a green pen; and if CC is Blue, he cannot buy a blue pen.

Determine the minimum amount of money he needs to buy one pen.

Constraints

  • 1R,G,B100 1\leq R,G,B\leq 100
  • RR, GG, and BB are integers.
  • CC is Red, Green, or Blue.

Input

The input is given from Standard Input in the following format:

RR GG BB

CC

Output

If the minimum amount of money Takahashi needs to buy one pen is XX yen, print XX.

Sample Input 1

20 30 10
Blue

Sample Output 1

20

A red pen costs 2020 yen, a green pen costs 3030 yen, and a blue pen costs 1010 yen. Takahashi cannot buy a blue pen, but he can buy a red pen for 2020 yen.

Sample Input 2

100 100 100
Red

Sample Output 2

100

Sample Input 3

37 39 93
Blue

Sample Output 3

37