l = [int(input()) for i in range(5)]

result = 9
sum = 0
for i in range(5):
  if l[i] % 10 < result and l[i] % 10 != 0:
    num = i
    result = l[i] % 10

finalMenuNumber = l.pop(num)

for i in range(4):
  if l[i] % 10 == 0:
    sum += l[i]
  else:
    sum += ((l[i]//10)+1)*10

print(sum+finalMenuNumber)