One Number for City Hall

City Hall wants a single number to show on lobby screens: today’s average outdoor temperature in Celsius.
Different departments send reports in mixed units - Celsius, Fahrenheit, and Kelvin - and they need your help to combine them.

The first line of the input contains a single integer n - the number of temperature readings received.

Each of the next n lines contains a value and a unit, separated by a space. The unit is one of C, F, or K. Values can be integers or decimals.

Your program should convert every reading to Celsius, compute the arithmetic mean, and print it.

Input

Output

3
32 F
300 K
40 C

22.283

4
68 F
293.15 K
20 C
77 F

21.25

2
300.15 K
86 F

28.5

Conversions

  • C → C : C

  • F → C : (F - 32) * 5 / 9

  • K → C : K - 273.15

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue