Uncowed Forces
Contest: Codeforces Round 334 (Div. 2)
Difficulty rating: 1000
Tags: implementation

Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challenging tasks, Kevin was uncowed and bulldozed through all of them, distinguishing himself from the herd as the best cowmputer scientist in all of Bovinia. Kevin knows his submission time for each problem, the number of wrong submissions that he made on each problem, and his total numbers of successful and unsuccessful hacks. Because Codeforces scoring is complicated, Kevin wants you to write a program to compute his final score.

Codeforces scores are computed as follows: If the maximum point value of a problem is x, and Kevin submitted correctly at minute m but made w wrong submissions, then his score on that problem is $$\max \left( 0.3x, \left( 1 - \frac{m}{250} \right)x - 50w \right)$$. His total score is equal to the sum of his scores for each problem. In addition, Kevin's total score gets increased by 100 points for each successful hack, but gets decreased by 50 points for each unsuccessful hack.

All arithmetic operations are performed with absolute precision and no rounding. It is guaranteed that Kevin's final score is an integer.

Input format:
The first line of the input contains five space-separated integers m1, m2, m3, m4, m5, where mi (0 ≤ mi ≤ 119) is the time of Kevin's last submission for problem i. His last submission is always correct and gets accepted.

The second line contains five space-separated integers w1, w2, w3, w4, w5, where wi (0 ≤ wi ≤ 10) is Kevin's number of wrong submissions on problem i.

The last line contains two space-separated integers hs and hu (0 ≤ hs, hu ≤ 20), denoting the Kevin's numbers of successful and unsuccessful hacks, respectively.

Output format:
Print a single integer, the value of Kevin's final score.

Constraints:
Time limit: 1.0 s
Memory limit: 256.0 MB

Note:
In the second sample, Kevin takes 119 minutes on all of the problems. Therefore, he gets $$( 1 - \frac { 1 1 9 } { 2 5 0 } ) = \frac { 1 3 1 } { 2 5 0 }$$ of the points on each problem. So his score from solving problems is $${ \frac { 1 3 1 } { 2 5 0 } } ( 5 0 0 + 1 0 0 0 + 1 5 0 0 + 2 0 0 0 + 2 5 0 0 ) = 3 9 3 0$$. Adding in 10·100 = 1000 points from hacks, his total score becomes 3930 + 1000 = 4930.

Example input:
20 40 60 80 100
0 1 2 3 4
1 0

Example output:
4900

Example input:
119 119 119 119 119
0 0 0 0 0
10 0

Example output:
4930

Editorial:
Hint: Just do it! But if you're having trouble, try doing your computations using only integers.
This problem is straightforward implementation—just code what's described in the problem statement. However, floating point error is one place where you can trip up. Avoid it by rounding (adding 0.5 before casting to int), or by doing all calculations with integers. The latter is possible since 250 always divides the maximum point value of a problem. Thus when we rewrite our formula for score as $$\max \left( 3 \cdot x / 10, ( 250 - m ) \cdot x / 250 \right)$$, it is easy to check that we only have integers as intermediate values.