import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
l = [A,B,C,D,E]
l_a = [A%10,B%10,C%10,D%10,E%10]
dif = 9
for j in l_a:
    if j == 0:
        pass
    else:
        if j <= dif:
            dif = j
ans = 0
for i in l:
    if i % 10 == 0:
        ans += i
    else:
        ans += i + (10 - i % 10)
a = ans - (10 - dif)
print(a)