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+(a[i]//10)
    if a[i]/10!=0:
      count=count+1
count=count*10+a[c]
print(count)