X = [0]*5
Y = [0]*5
diff = [0]*5

for i in range(5):
    X[i] = int(input())

Y = [(x // 10)*10 if x % 10 == 0 else (x // 10 + 1)*10 for x in X]
dif = [Y[i]-X[i] for i in range(5)]

i = 0
sum = 0
count = 0

for i in range(5):
    if (dif[i] != max(dif)):
        sum = sum + Y[i]
    else:
        s = Y[i]
        t = X[i]
        count = count + 1

sum = sum + (count-1)*s + t

print(sum)