cho.sh
Notes
Loading...

Mobile Phone Bill

Time limit

2s

Memory limit

128 MB

Problem

Dongho wants to choose the cheaper of two phone plans using his call records from last month.

The Youngsik plan charges 10 won for every started 30-second block of a call. A call from 1 to 29 seconds costs 10 won, a call from 30 to 59 seconds costs 20 won, and a call from 60 to 89 seconds costs 30 won.

The Minsik plan charges 15 won for every started 60-second block of a call. A call from 1 to 59 seconds costs 15 won, a call from 60 to 119 seconds costs 30 won, and a call from 120 to 179 seconds costs 45 won.

Given the list of call durations, print the cheaper plan and its total cost.

Input

The first line contains the number of calls N from last month. N is a natural number not greater than 20. The second line contains N call durations in seconds. Each duration is a natural number not greater than 10,000.

Output

Print the name of the cheaper plan and the total cost on one line, separated by spaces. Print Y for the Youngsik plan and M for the Minsik plan.

If the two plans have the same total cost, print Y M first, followed by the cost.