atcoder#ABC243A. [ABC243A] Shampoo
[ABC243A] Shampoo
Score : points
Problem Statement
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 , , and milliliters of shampoo, respectively.
This morning, the bottle contained milliliters of shampoo. Without refilling, who will be the first to run short of shampoo to wash their hair?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If the first person to run short of shampoo to wash their hair is Takahashi's father, print F
; if it is Takahashi's mother, print M
; if it is Takahashi, print T
.
25 10 11 12
T
Now, they have milliliters of shampoo.
- First, Takahashi's father uses milliliters, leaving .
- Next, Takahashi's mother uses milliliters, leaving .
- Finally, Takahashi tries to use milliliters and runs short of shampoo since only is remaining.
30 10 10 10
F
Now, they have milliliters of shampoo.
- First, Takahashi's father uses milliliters, leaving .
- Next, Takahashi's mother uses milliliters, leaving .
- Then, Takahashi uses milliliters, leaving .
- Next day, Takahashi's father tries to use milliliters and runs short of shampoo since only is remaining.
100000 1 1 1
M