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

l = sorted([a,b,c,d,e], key=lambda x: x%10, reverse=True)

def tyumon(t, ans):
  ans += t
  if ans % 10 == 0:
    return ans
  else:
    return (ans//10 + 1)*10

ans = 0
for i in range(len(l)-1):
  ans = tyumon(l[i], ans)
print(ans + l[-1])