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

l = [a,b,c,d,e]
nl = []
ans = 0
for t in l:
  if t%10 == 0:
    ans += t
  else:
    nl.append(t)
    
nl = sorted(nl, 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

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