Geunwoo is learning an interesting card game today.
Cards come in four colors: red, blue, yellow, and green. Each color has nine cards numbered from 1 to 9.
There are $36=4\times 9$ cards in total. In the game Geunwoo learned, five of the 36 cards are drawn, and an integer score is calculated using the rules below.
Each card is represented as follows. Its color is written as an uppercase English letter R, B, Y, or G, meaning red, blue, yellow, or green respectively. For example, Y8 means a yellow 8, and B5 means a blue 5.
Scoring rules
If all five cards have the same color and consecutive numbers, the score is the highest number plus 900. For example: Y4, Y3, Y2, Y5, Y6 → $906=6+900$.
If four of the five cards have the same number, the score is that number plus 800. For example: B3, R3, B7, Y3, G3 → $803=3+800$.
If three cards have the same number and the other two also have the same number, multiply the number on the three cards by 10, add the number on the two cards, and then add 700. For example: R5, Y5, G7, B5, Y7 → $757=5\times 10+7+700$.
If all five cards have the same color, the score is the highest number plus 600. For example: Y3, Y4, Y8, Y6, Y7 → $608=8+600$.
If the five numbers are consecutive, the score is the highest number plus 500. For example: R7, R8, G9, Y6, B5 → $509=9+500$.
If three of the five cards have the same number, the score is that number plus 400. For example: R7, Y7, R2, G7, R5 → $407=7+400$.
If two cards have the same number and another two cards have the same number, multiply the larger of the two repeated numbers by 10, add the smaller, and then add 300. For example: R5, Y5, Y4, G9, B4 → $354=5\times 10+4+300$.
If two of the five cards have the same number, the score is that number plus 200. For example: R5, Y2, B5, B3, G4 → $205=5+200$.
If none of the above cases applies, the score is the highest number plus 100. For example: R1, R2, B4, B8, Y5 → $108=8+100$.
Given five cards, write a program to calculate the score of the card game. If two or more rules apply, the score is the highest obtainable score.
Input
The first through fifth lines each contain one card. A single space separates its color and number.
Output
Output the score on one line.
Examples
Input 1
B 3 B 7 R 1 B 2 Y 7
Output 1
207