Shampoo

AtCoder
IDabc243_a
Time2000ms
Memory256MB
Difficulty
Three people live in Takahashi's house: Takahashi, his father, and his mother. All of them wash their hair in the bathroom each night. His father, his mother, and Takahashi take a bath in this order and use $A$, $B$, and $C$ milliliters of shampoo, respectively. This morning, the bottle contained $V$ milliliters of shampoo. Without refilling, who will be the first to run short of shampoo to wash their hair? ## Constraints * $1 \leq V,A,B,C \leq 10^5$ * All values in input are integers. ## Input Input is given from Standard Input in the following format: $V$ $A$ $B$ $C$ [samples]
Samples
Input #1
25 10 11 12
Output #1
T

Now, they have $25$ milliliters of shampoo.

*   First, Takahashi's father uses $10$ milliliters, leaving $15$.
*   Next, Takahashi's mother uses $11$ milliliters, leaving $4$.
*   Finally, Takahashi tries to use $12$ milliliters and runs short of shampoo since only $4$ is remaining.
Input #2
30 10 10 10
Output #2
F

Now, they have $30$ milliliters of shampoo.

*   First, Takahashi's father uses $10$ milliliters, leaving $20$.
*   Next, Takahashi's mother uses $10$ milliliters, leaving $10$.
*   Then, Takahashi uses $10$ milliliters, leaving $0$.
*   Next day, Takahashi's father tries to use $10$ milliliters and runs short of shampoo since only $0$ is remaining.
Input #3
100000 1 1 1
Output #3
M
API Response (JSON)
{
  "problem": {
    "name": "Shampoo",
    "description": {
      "content": "Three people live in Takahashi's house: Takahashi, his father, and his mother. All of them wash their hair in the bathroom each night.   His father, his mother, and Takahashi take a bath in this order",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc243_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Three people live in Takahashi's house: Takahashi, his father, and his mother. All of them wash their hair in the bathroom each night.  \nHis father, his mother, and Takahashi take a bath in this order...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments