x=list(map(int,input().split(",")))
f=list(map(int,input().split(",")))
def jj(step): if __________: t = 0 else: t = 0.3 + (step - 1000) // 2000 * 0.1 t = min(3,t) return(t) x=list(map(int,input().split(","))) f=list(map(int,input().split(","))) n=len(f) total, c = 0, 0 for i in range(n): if f[i]==1: __________ if c >= 4: total =total+ 2*jj(x[i]) else: total += jj(x[i]) else: __________ print(round(total,1))