A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
lst = [A,B,C,D,E]
rem = [ele%10 for ele in lst]
last = rem.index(min(filter(None,rem)))
ans = 0
for i in range(5):
    if rem[i] == 0 or i == last:
        ans += lst[i]
    else:
        ans +=( lst[i] + (10-rem[i]))
print(ans)