lis = [int(input()) for _ in range(5)]
lis1 = [lis[i]%10 for i in range(5)]
lis10 = [lis[i]//10 for i in range(5)]
ans = 0
for i in range(5):
    if lis1[i]:
        ans += 10
    if not lis1[i]:
        lis1[i] = 10
minlis1 = min(lis1)
if minlis1 == 10:
    minlis1 = 0
ans += sum(lis10)*10
ans += minlis1-10

print(ans)
