

Code AirNowadays, most airlines determine the price of their tickets dynamically. The amount passengers have to pay for a journey may depend on the date of purchase, the load factor of the selected flight, and even the chosen seat. Code Air is operating aircraft of different types, but there are exactly six seats in a row in each aircraft. However, the lengths of the aircraft (and thus, the number of rows) vary from type to type, and so do the positions of emergency exit row seats, which provide more generous legroom. Rows are numbered from the front of the plane, and columns (seats in a row) are labeled with a letter from A to F.
Unfortunately, the programmers of the airline have gone on strike, so you are asked to implement the sales algorithm. Input SpecificationThe first line of the input contains four integers:
The second line contains two integers: the number of rows R and the number of emergency exit rows E. The third line consists of E positive integers, the numbers of the emergency exit rows. Each of the remaining lines of the input contains the identifier of a purchased seat in the form SO, where S is the number of a valid row, and O is the valid label of the selected column. The values read from the input and computed during the calculations all fit in a 32bit signed integer. Output Specification
The first line of the output should contain the total income after the ticket sales. This is
followed by as many lines as the number of purchases. These lines are of the form
seat Sample Input
Output for Sample Input


University of Debrecen; Faculty of Informatics; v. 03/01/2019 