import sys
lst=[]
ans=0
for i in range(5):
  a=int(input())
  if a%10==0:
    ans+=a
  else:
    lst.append(a)
C=[[] for _ in range(len(lst))]   
for i in range(len(lst)):
  v=lst[i]
  c=v%10
  C[i]=[-c,v]
C=sorted(C)
for i in range(len(lst)-1):
  v=C[i][1]
  c=-C[i][0]
  ans+=(v+(10-c))
print(ans+C[-1][1])