import numpy as np

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ins = np.zeros(5)
ins[0] = a
ins[1] = b
ins[2] = c
ins[3] = d
ins[4] = e

ls = np.zeros(5)
ls[0] = a%10
ls[1] = b%10
ls[2] = c%10
ls[3] = d%10
ls[4] = e%10
x = np.argsort(ls)

ans = 0
for i in range(5):
    if ls[i]==0:
        ans = ans+ins[i]
    elif i==x[0]:
        ans = ans+ins[i]
    else:
        ans = ans + ((ins[i]//10)+1)*10
print(int(ans))
