import math 
a = [int(input())for i in range(5)]
rest = []
t = 0
for i in a:
  if i%10 == 0 :
    t+=i
  else:
    rest.append(i)

f = sorted(rest, key=lambda x:str(x)[-1] ,reverse=True)
c = [math.ceil(i/10)*10for i in f[:-1]]

t += sum(c)+f[-1]

print(t)