Contest Duration: - (local time) (100 minutes) Back to Home
A - Buy a Pen /

Time Limit: 2 sec / Memory Limit: 1024 MB

### 制約

• 1\leq R,G,B\leq 100
• R,G,B は整数
• CRed,Green,Blue のいずれか

### 入力

R G B
C


### 入力例 1

20 30 10
Blue


### 出力例 1

20


### 入力例 2

100 100 100
Red


### 出力例 2

100


### 入力例 3

37 39 93
Blue


### 出力例 3

37


Score : 100 points

### Problem Statement

Takahashi came to a store to buy a pen. Here, a red pen costs R yen, a green pen costs G yen, and a blue pen costs B yen.

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

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

### Constraints

• 1\leq R,G,B\leq 100
• R, G, and B are integers.
• C is Red, Green, or Blue.

### Input

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

R G B
C


### Output

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

### Sample Input 1

20 30 10
Blue


### Sample Output 1

20


A red pen costs 20 yen, a green pen costs 30 yen, and a blue pen costs 10 yen. Takahashi cannot buy a blue pen, but he can buy a red pen for 20 yen.

### Sample Input 2

100 100 100
Red


### Sample Output 2

100


### Sample Input 3

37 39 93
Blue


### Sample Output 3

37