a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
import numpy as np
num=[a,b,c,d,e]
resi=[i%10 for i in num]
x=np.argsort(resi)
minnum=num[x[0]]
del(num[x[0]])
sumnum=sum([((i//10)+1)*10 for i in num])
res=sumnum+minnum
print(res)