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
for i in range(5):
  if i==lastban:
    alltime+=l[i]
  elif i!=lastban:
    alltime+=int(l[i]/10)*10+10
print(alltime)