a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

total = 0
min_mod = 9
for t in (a,b,c,d,e):
  total += (t + 9) // 10
  if t%10 != 0:
    min_mod = min(t%10, min_mod)

ans = (total - 1) * 10 + min_mod
print(ans)