# 244. Lottery

## I'm a slow walker, but I never walk backwards.

Please write a program to calculate lottery prize. Each lottery number is a 8-digit integer. You will be given three special prize numbers and three first prize numbers. The prize is determined according to the following rules.

• A number matching a special prize number receives 2000000 dollars.
• A number matching a first prize number receives 200000 dollars.
• A number whose last 7 digits match the last 7 digits of a first prize number receives 40000 dollars.
• A number whose last 6 digits match the last 6 digits of a first prize number receives 10000 dollars.
• A number whose last 5 digits match the last 5 digits of a first prize number receives 4000 dollars.
• A number whose last 4 digits match the last 4 digits of a first prize number receives 1000 dollars.
• A number whose last 3 digits match the last 3 digits of a first prize number receives 200 dollars.

## Input

The first three lines of the input are the special prize numbers. The second three lines are the first prize number. The rest of the input are your lottery numbers, one per line. All the numbers are positive integers between 10000000 and 99999999. You must process all numbers until end of file.

## Output

The output is the sum of the dollars from all lottery numbers.

## Sample input

5513869014764045411757336878760877978391110710741237839168787608


## Sample output

204000