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]
lastamari=min(tenmod)
lastban=tenmod.index(lastamari)
alltime=0
if lastamari==0:
  print(sum(l))
else:
  for i in range(5):
    if i==lastban:
      alltime+=l[i]
    else:
      if l[i]%10==0:
        alltime+=l[i]
      else:
        alltime+=int(l[i]/10)*10+10
  print(alltime)
