Олимпиадный тренинг

Задача 33652. Air conditioner


A new type of air conditioner has been installed in the office where the programmer Petr works. This conditioner differs in special simplicity in management. The air conditioner has only two controllable parameters: the desired temperature and operating mode.

The air conditioner can operate in the following four modes:

  • "freeze" — cooling. In this mode, the air conditioner can only reduce the temperature. If the temperature in the room is already not higher than desired, then it turns off.
  • "heat" — heat. In this mode, the air conditioner can only increase the temperature. If the temperature in the room is already not less than desired, then it turns off.
  • "auto" — auto mode. In this mode, the air conditioner can either increase or decrease the temperature in the room to the desired one.
  • "fan" — ventilation. In this mode, the air conditioner only ventilates the air and does not change the temperature in the room.

The air conditioner is powerful enough, so when set to the correct operating mode, it brings the temperature in the room to the desired one in an hour.

It is required to write a program that, according to the set temperature in the room troom, installed on the air conditioner, the desired temperature tcond and operating mode determines the temperature that will be established in the room in an hour.

Input: The first line contains two integers troom, and tcond separated by exactly one space (–50 ≤ troom< /sub> ≤ 50, –50 ≤ tcond ≤ 50) .

The second line contains a single word written in lowercase Latin letters — air conditioner operation mode.

Output: You need to output the bottom integer — the temperature that will be established in the room in an hour.

Note: 
In the first example, the air conditioner is in heating mode. In an hour, he will heat the room to the desired temperature of 20 degrees.

In the second example, the air conditioner is in cooling mode. Since the temperature in the room is lower than the desired temperature, the air conditioner turns off by itself and the temperature in the room does not change.
Examples

# Input Output
1 10 20
heat
20
2 10 20
freeze
10