import math
list=[int(input()) for x in range(5)]
list.sort(key=lambda x:x%10)
count=0
for l in list:
  if l%10==0:
    count+=1
a=list[count]
del list[count]
ans=[]
for t in list:
  ans.append(math.ceil(t/10)*10)
print(sum(ans)+a)