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 $\operatorname{max}(0.3 x,(1 - \frac{m}{250}) x - 50 w)$. 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-----

The first line of the input contains five space-separated integers m_1, m_2, m_3, m_4, m_5, where m_{i} (0 ≤ m_{i} ≤ 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 w_1, w_2, w_3, w_4, w_5, where w_{i} (0 ≤ w_{i} ≤ 10) is Kevin's number of wrong submissions on problem i.

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


-----Output-----

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


-----Examples-----
Input
20 40 60 80 100
0 1 2 3 4
1 0

Output
4900

Input
119 119 119 119 119
0 0 0 0 0
10 0

Output
4930



-----Note-----

In the second sample, Kevin takes 119 minutes on all of the problems. Therefore, he gets $(1 - \frac{119}{250}) = \frac{131}{250}$ of the points on each problem. So his score from solving problems is $\frac{131}{250}(500 + 1000 + 1500 + 2000 + 2500) = 3930$. Adding in 10·100 = 1000 points from hacks, his total score becomes 3930 + 1000 = 4930.

Difficulty: interview

Starter code:

Solutions:
m = list(map(int, input().split()))
w = list(map(int, input().split()))
a = [500, 1000, 1500, 2000, 2500]
v = list(map(int, input().split()))
ans = 0
for i in range(len(m)):
    ans += max(0.3 * a[i], (1 - m[i] / 250) * a[i] - 50 * w[i])
ans += v[0] * 100
ans -= v[1] * 50
print(int(ans))


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ans = c[0] * 100 - c[1] * 50
for i in range(5):
    ans += max(0.3 * (i + 1) * 500, (1 - a[i] / 250) * (i + 1) * 500 - 50 * b[i])
print(round(ans))

M = list(map(int,input().split()))
W = list(map(int,input().split()))
s,e = list(map(int, input().split()))
P = [500,1000,1500,2000,2500]
r = 0
for k in range(5):
    r += max([0.3*P[k],(1-(M[k]/250))*P[k] - 50*W[k]])
print(int(r+100*s-50*e))


def g(w,m,x):
    return max(0.3*x,(1-m/250)*x-50*w)


m1,m2,m3,m4,m5=map(int,input().split())
w1,w2,w3,w4,w5=map(int,input().split())
h1,h2=map(int,input().split())
print(int(g(w1,m1,500)+g(w2,m2,1000)+g(w3,m3,1500)+g(w4,m4,2000)+g(w5,m5,2500)+h1*100-h2*50))

m = list(map(int, input().split()))
w = list(map(int, input().split()))
q = [500, 1000, 1500, 2000, 2500]
s = 0
for i in range(5):
    s += max(0.3 * q[i], (1 - m[i] / 250) * q[i] - 50 * w[i])
h1, h2 = list(map(int, input().split()))
s += 100 * h1
s -= 50 * h2
print(int(s))


ans = 0;
time = list(map(int,input().split()))
tries = list(map(int,input().split()))
ball = [500,1000,1500,2000,2500]
z = list(map(int,input().split()))
gv = z[0]
bv = z[1]
for i in range(0,5):
    ans += max(0.3*ball[i],(1-time[i]/250)*ball[i] - 50*tries[i])
    
    
ans += 100*gv
ans -= 50*bv
print(int(ans))


max_scores = [ 500, 1000, 1500, 2000, 2500 ]
corects = [ int(c) for c in input().split() ]
wrongs = [ int(w) for w in input().split() ]
shacks, unshacks = map(int, input().split())
final_score = shacks*100 - unshacks*50

def score(x, m, w):
  return max(0.3*x, (1-(m/250))*x-50*w)

for i in range(5):
  final_score += score(max_scores[i], corects[i], wrongs[i])
print(int(final_score))

def score(m, w, x):
    return max(0.3*x, (1.0 - m/250) * x - 50*w)

ms = list(map(int, input().split()))
ws = list(map(int, input().split()))
hs, hu = list(map(int, input().split()))

score = sum(score(m, w, x) for m, w, x in zip(ms, ws, [500,1000,1500,2000,2500]))
print(int(score + 100 * hs - 50 * hu))


def score(m,w,x):
    return max(0.3*x,(1-m/250)*x-50*w)
m1,m2,m3,m4,m5=(list(map(int,input().split())))
w1,w2,w3,w4,w5=(list(map(int,input().split())))
hs,hu=(list(map(int,input().split())))
x1,x2,x3,x4,x5=(500,1000,1500,2000,2500)
print(round(score(m1,w1,x1)+score(m2,w2,x2)+score(m3,w3,x3)+score(m4,w4,x4)+score(m5,w5,x5))+100*hs-50*hu)


m = list(map(int, input().split()))
w = list(map(int, input().split()))
n1, n2 = list(map(int, input().split()))
ans = n1 * 100 - n2 * 50
for i in range(5):
    col = 500 * (i + 1)
    ans += max(0.3 * col, (1 - m[i] / 250) * col - 50 * w[i])
print(int(ans))


x = [500, 1000, 1500, 2000, 2500]
m = list(map(int, input().split()))
w = list(map(int, input().split()))
hs, hu = map(int, input().split())
print(sum(max(3 * x[i] // 10, x[i] - x[i] * m[i] // 250 - 50 * w[i]) for i in range(5)) + hs * 100 - hu * 50)

point = [500, 1000, 1500, 2000, 2500]
minutes = list(map(int, input().split()))
wrong = list(map(int, input().split()))
hack = list(map(int, input().split()))
answer = 0

for x, m, w in zip(point, minutes, wrong):
    answer += max(0.3 * x, (1 - m / 250) * x - 50 * w)

answer += hack[0] * 100 - hack[1] * 50

print(int(answer))


import math
from decimal import *
import sys
from fractions import Fraction

M=list(map(int,input().split()))
W=list(map(int,input().split()))
H=list(map(int,input().split()))
X=[500,1000,1500,2000,2500]

ans = H[0]*100-H[1]*50

for i in range(0,5):
   ans += int(max(0.3 * X[i] , (250 - M[i]) * (X[i]/250) - 50*W[i]))
print(ans)

   

   
 


import sys

arr1 = [int(x) for x in sys.stdin.readline().split()]
arr2 = [int(x) for x in sys.stdin.readline().split()]
base = [500, 1000, 1500, 2000, 2500]
res = 0

for i in range(5):
    res += max([0.3 * base[i], base[i] * (1 - arr1[i] / 250) - 50 * arr2[i]])

a, b = [int(x) for x in sys.stdin.readline().split()]
res += 100 * a
res -= 50 * b

print(int(res))


times = list(map(int, input().split()))
att = list(map(int, input().split()))
n,m = list(map(int, input().split()))
sc = 0
for i in range(5):
	sc += max ( 150 * (i+1),  ( 1 - times[i] / 250 ) * 500 * (i+1) - 50 * att[i] )
sc += 100 * n 
sc -= 50 * m
print(int(sc)) 



m = list(map(int, input().split()))
w = list(map(int, input().split()))
h = [500, 1000, 1500, 2000, 2500]
s, u = list(map(int, input().split()))
su = 0.0
for i in range(5):
    su += max(0.3*h[i], (1.0-m[i]/250.0)*h[i] - 50.0*w[i])
su += s*100.0
su -= u*50.0
print(int(su))


res = 0
c = [500,1000,1500,2000,2500]
a = list(map(int,input().split()))
w = list(map(int,input().split()))
hs,hu = map(int,input().split())
for i in range(5):
    res += max(0.3*c[i],(1-a[i]/250)*c[i]-50*w[i])
print(int(res+hs*100-50*hu))

def __starting_point():

    x = [500,1000,1500,2000,2500]
    m = [int(x) for x in input().split()]
    w = [int(x) for x in input().split()]
    hs , hu = [int(x) for x in input().split()]

    res = 0
    for i in range(5):
        res += max( 3*x[i]//10 , x[i] - m[i]*x[i]//250 - 50*w[i] )
    res += 100*hs
    res -= 50*hu
    print(res)
__starting_point()

def main():
    mode="filee"
    if mode=="file":f=open("test.txt","r")
    get = lambda :[int(x) for x in (f.readline() if mode=="file" else input()).split()]
    m=get()
    w=get()
    h=get()
    ans=0
    s=500
    for i in range(5):
        ans+=max(0.3*s, (1- m[i]/250)*s - 50*w[i])
        s+=500
    ans+=(100*h[0] - 50*h[1])
    print(int(ans))
    


    if mode=="file":f.close()


def __starting_point():
    main()

__starting_point()

sc=[1]*10
mrk=input().split()
for i in range (0,5):
    mrk[i]=int(mrk[i])
    sc[i]=500*(i+1)
wr=input().split()
for i in range (0,5):
    wr[i]=int(wr[i])
s=0
for i in range (0,5):
    s+=max((0.3*sc[i]),(1-(mrk[i]/250))*sc[i]-(50*wr[i]))
l=input().split()
s+=100*int(l[0])-50*int(l[1])
print(int(s))



problems = [ 500, 1000, 1500, 2000, 2500 ]
submitted = list(map(int, input().split()))
wrong = list(map(int, input().split()))

score = 0
for pos, x in enumerate(problems):
    m = submitted[pos]
    w = wrong[pos]
    score += max( 3 * x // 10,  x - m * x // 250 - 50 * w )

good, bad = list(map(int, input().split()))
score += good * 100 - bad * 50

print(score)


xs = [500, 1000, 1500, 2000, 2500]
ms = [int(x) for x in input().split()]
ws = [int(x) for x in input().split()]
hacks = [int(x) for x in input().split()]

res = 0
for i in range(len(xs)):
    problem = max(0.3 * xs[i], (1 - ms[i]/250) * xs[i] - 50*ws[i])
    res += problem

res += 100*hacks[0] - 50*hacks[1]
print(int(res))


m = list(map(int, input().split()))
w = list(map(int, input().split()))
hs, hu = map(int, input().split())

s = [500 * (x + 1) for x in range(5)]

for i in range(5):
    s[i] = max(0.3 * s[i], (1 - m[i]/250) * s[i] - 50 * w[i])

s_t = sum(s) + 100 * hs - 50 * hu

print(int(s_t))

m = list(map(int, input().split(" ")))
w = list(map(int, input().split(" ")))

hs, hu = list(map(int, input().split(" ")))

s = 0

s += hs*100 - hu*50

for i in range(5):
    s+= max(0.3*((i+1)*500), (1-m[i]/250)*((i+1)*500) - 50*w[i])
    
print(int(s))


__author__ = 'MoonBall'

import sys
# sys.stdin = open('data/A.in', 'r')
T = 1

def process():
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    z = [500, 1000, 1500, 2000, 2500]
    total = 0
    for _ in range(5):
      total += max(0.3 * z[_], (1 - a[_] / 250) * z[_] - 50 * b[_])
    total += 100 * c[0] - 50 * c[1]

    print(int(total))






for _ in range(T):
    process()