## FALTAENV - Falta Envido

no tags

Envido is an important part of the typical argentinian game Truco. It is even more important
when Falta Envido is called, because in this case the winner of the Envido wins the entire game.
In this problem you are asked to calculate the envido advantage of a cheater.
Truco is played with a limited deck of spanish cards. This deck contains four suits: espada,
basto, copa and oro. There are 10 cards of each suit: 1, 2, 3, 4, 5, 6, 7, 10, 11 and 12. Cards
10, 11 and 12 have an envido value of 0, while the envido value for any of the other cards is
simply its number. Each player holds three cards. The winner of an Envido is the player with
the higher envido score. When calculating his envido score each player can either:
1. select a single card and have as envido score the envido value of the card; or
2. select two cards of the same suit and have as envido score 20 plus the sum of the envido
value of each selected card.
Players always select the card or cards that yield the highest envido score. For instance, a
player having a 10 and a 2 of the same suit, together with a 5 of a different suit, would inform
an envido score of 22 because 20 + 0 + 2 = 22.
A cheater playing Truco thinks that he can change one of his three cards without anybody else
in the table noticing. If he changes more than one card, he surely will be discovered, so he does
not do that. Since even changing one card is risky, he only does it when the envido score of the
resulting hand is much higher than the one of his original hand.
Given the cards the cheater has in hand, you must calculate the maximum increase he can get
in the envido score by exchanging one of his cards with a card from the deck. Notice that the
resulting hand must be formed by two of his original cards and one new card selected from the
deck, and that he cannot have two equal cards (same number and suit).

### Input

The input contains several test cases. Each test case is described in a single line that contains
six values N1 , S1 , N2 , S2 , N3 , and S3 separated by single spaces. Each pair (Ni , Si ) describes
a card in the hand of the cheater (1 ≤ i ≤ 3), where Ni is the number of the card (1, 2, 3, 4,
5, 6, 7, 10, 11 or 12), and Si is its suit (espada, basto, copa or oro). You may assume that the
three cards are different. The last line of the input contains three times the number −1 and an
asterisk, with the six values separated by single spaces, and should not be processed as a test
case.

### Output

For each test case output a single line with an integer representing the maximum increase in
the envido score that can be obtained by replacing exactly one card of the input hand.

### Example

```Input:12 espada 10 basto 11 basto7 espada 1 oro 2 oro7 espada 1 oro 6 espada-1 * -1 * -1 *Output:
7100```