| AGM 2020, Final Round, Day 1 |
|---|
| Finished |
Ben found an old game box in his grandfather's basement and is looking forward to having $$$AGM$$$ (A Great Moment) playing it. In the box he found a game table with $$$12$$$ rows ($$$9-12$$$ are extra) and $$$6$$$ columns, $$$7$$$ types of pieces (which we will further call I, O, L, J, T, S, Z), and a description of the game:
Find below a description of each game piece. Notice how each of them fits into a $$$4 \times 4$$$ square matrix. Each black square represents an element of the piece. We'll consider the origin of each piece, the top left corner of this matrix. A rotation of ONE step corresponds to a transition between adjacent states of the same piece.
Ben wonders what is the maximum possible score that can be achieved by correctly using a given set of pieces. Can you help Ben out?
The first line of the input contains the number of game pieces $$$N$$$ ($$$1 \leq N \leq 5$$$).
The second line contains a string of length $$$N$$$ containing the game pieces.
The following $$$8$$$ lines, each contain a string length $$$6$$$. The character '.' signifies an open position on the game table, while the character '#' signifies an unavailable position on the game table. No other characters are used.
The output file should contain one integer representing the maximum possible score which can be obtained through strategic and well planned $$$AGM$$$s (A Great Moments).
4 ZLTI ###..# ###..# ###..# ###..# ###..# ...... ...... #....#
1100
| Name |
|---|


