import math
a=[int(input()) for i in range(5)]
b=[0]*5
for i in range(5):
  b[i]=(a[i]%10)
c=min(b)
c=b.index(c)
count=0
for i in range(5):
  if i!=c:
    count=count+math.ceil((a[i]//10))
count=count*10+a[c]
print(count)