Far away there was a village where all kinds of animals lived together. Every year the village held a festival with several contests, and one of them was Crossword. This year the match is between the rabbit team and the turtle team, and the rules go like this.
The equipment is a standard 15 x 15 board and letter tiles from 'A' to 'Z'. The supply of tiles is unlimited, and each team keeps 7 tiles on its rack.
A round is split into two turns. The rabbit team always plays the second turn.
On the first turn the turtle puts tiles in a row or a column with no gap so that they spell a meaningful word. One of those tiles has to land on the star square.
On the second turn the rabbit adds tiles next to the tiles the turtle placed. Every tile the rabbit puts down has to lie in one line, and every group of letters that ends up adjacent, read across and read down, has to be a meaningful word. The new word has to contain at least one letter that the turtle placed. For example, if CAN is on the board, one of these plays is allowed.

These plays are not allowed.

To score, add up the value of every tile of the word in the line just played, including the tiles that were already on the board. Tiles put on a special square earn a bonus.
Apply the letter multipliers first, then apply the word multipliers to the sum. If the play covers several word multiplier squares, multiply by all of them. Covering one 2W square and one 3W square makes the whole word count six times. A square that a tile already covers gives no bonus.
When the match ends, the team with the highest total wins.
This is the first year the rabbit enters the Crossword contest. It studied the rules closely but forgot to memorize any vocabulary, so it knows only two words, VERY and EASY. Out of pride the rabbit decides to play tiles only in a way that spells VERY or EASY.
Now it is the rabbit's turn. Its play has to satisfy all of the conditions below. A letter group here means letters that sit next to each other with no gap, across or down, extended as far as it goes.
Only the word the rabbit made is scored. Each tile on the rack is used at most once. Find the highest score the rabbit can get.
The first line holds the number of test cases T (1 ≤ T ≤ 10). Each test case looks like this.
The rabbit has at least one legal play with the tiles on its rack. The star square is always the centre of the board, the 8th square of the 8th line. The tiles A, E, R and S are worth 1 point each, and the tiles V and Y are worth 4 points each.
For each test case, print one line with the integer M, the highest score the rabbit can get by playing tiles that spell VERY or EASY.