a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
lastindex=0
tenmod=[a%10,b%10,c%10,d%10,e%10]
times=tenmod.count(0)
for i in range(times):
  tenmod.remove(0)
key=min(tenmod)
alltime=0
for i in range(5):
  if l[i]%10==0:
    alltime+=l[i]
  elif l[i]%10==key:
    alltime+=l[i]
  else:
    alltime+=int(l[i]/10)*10+10
print(alltime)
