a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a%10,b%10,c%10,d%10,e%10]
lst.sort()
cnt = 0
for i in range(len(lst)):
  if lst[i] == 0:
    cnt += 1
if cnt == 5:
  print(sum(lst))
else:
  print((a//10+b//10+c//10+d//10+e//10+4-cnt)*10+lst[cnt])
