import math
s = [int(input()) for i in range(5)]
ans = 0
minus = 9
for i in range(5):
    ans += math.ceil(s[i]/10)*10 

for i in range(5):
    if 1 <= s[i]%10 < minus:
        minus = s[i]%10
    else:
        continue
    


print(ans+minus-10)