s = [int(input()) for i in range(5)]
result = 0
last = 999
for i in range (len(s)):
    if s[i] % 10 <= last and s[i] % 10 != 0:
        last = s[i]

for i in range (len(s)):
    result += s[i] + (10 - s[i] % 10)

print(result - (10 - last % 10))