#abc243a. A - Shampoo

A - Shampoo

Score : 100100 points

问题陈述

在高桥家中共有三个人居住:高桥、他的父亲和母亲。他们每个人每晚都在浴室洗头。

按照顺序,他的父亲、母亲和高桥依次洗澡,并分别使用 AABBCC 毫升的洗发水。

今天早上,洗发水瓶中装有 VV 毫升的洗发水。如果不进行补充,谁会是第一个洗发水用完而无法洗头的人?

以上为通义千问 qwen-max 翻译,仅供参考。

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 AA, BB, and CC milliliters of shampoo, respectively.

This morning, the bottle contained VV milliliters of shampoo. Without refilling, who will be the first to run short of shampoo to wash their hair?

Constraints

  • 1V,A,B,C1051 \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:

VV AA BB CC

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.

Sample Input 1

25 10 11 12

Sample Output 1

T

Now, they have 2525 milliliters of shampoo.

  • First, Takahashi's father uses 1010 milliliters, leaving 1515.
  • Next, Takahashi's mother uses 1111 milliliters, leaving 44.
  • Finally, Takahashi tries to use 1212 milliliters and runs short of shampoo since only 44 is remaining.

Sample Input 2

30 10 10 10

Sample Output 2

F

Now, they have 3030 milliliters of shampoo.

  • First, Takahashi's father uses 1010 milliliters, leaving 2020.
  • Next, Takahashi's mother uses 1010 milliliters, leaving 1010.
  • Then, Takahashi uses 1010 milliliters, leaving 00.
  • Next day, Takahashi's father tries to use 1010 milliliters and runs short of shampoo since only 00 is remaining.

Sample Input 3

100000 1 1 1

Sample Output 3

M

update @ 2024/3/10 10:26:26