Buy a Pen

AtCoder
IDabc362_a
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
20 30 10
Blue
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.
Input #2
100 100 100
Red
Output #2
100
Input #3
37 39 93
Blue
Output #3
37
API Response (JSON)
{
  "problem": {
    "name": "Buy a Pen",
    "description": {
      "content": "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 p",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc362_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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.\nTakahashi dislikes the color $C$. If $C$ is `Red`, he cannot buy a red p...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments