Untied Airlines

No attempts yetTime limit1sMemory limit128 MB

Problem

An airline called Untied has been hit by a string of bad press. The flying public are not impressed, so Untied has decided to award upgrades on future flights whenever a passenger suffers certain kinds of poor service.

Poor service includes things such as lost luggage, a stewardess swiping a passenger in the face as she reaches past them, or cancelling flights at short notice without offering alternative flights in time for connections.

Each kind of poor service has a code and is worth a number of points. If a passenger collects at least 200 such points on a single flight, then their next flight is automatically upgraded. The service codes and their points are listed in the table below.

For each flight, report how many upgrades Untied must award.

Input

The input consists of a series of flights, each starting with a flight number. The input is terminated by a flight number that is just a single #; do not process that flight.

A flight number starts with the upper-case letters UT, followed by up to 4 digits (for example, UT525). Each line after the flight number begins with a seat number (a 2-digit number followed by a single letter, for example 25H meaning seat H in row 25). The seat number is followed by a space and then one of the letter codes, always upper case. The seat letter is in the range A to J.

The last seat number for a flight is 00A, which is not a valid seat; do not process it.

Table of codes and the points awarded:

Service ProblemCodePoints
Lost luggageL120
Struck by stewardessS150
Overbooked and bumped off the flight after checking inB150
Not greeted by nameN40
Not given a seat in the class paid forC160
Drinks trolley ran into passengerD100
Stewardess rudeR100
No space in the overhead lockerO100

Output

The output consists of a single line for each flight in the input. Each line contains the flight number, followed by a space, followed by the number of upgrades that must be awarded. If a flight has no upgrades to award, still print the flight number with a count of zero.