l = [int(input()) for i in range(5)]
ll = []
ans = -10
for i in range(5):
    if l[i] % 10 ==0:
        ans += l[i]
    else:
        ll.append(l[i]%10)
        ans += (l[i]//10 + 1)*10
if ll == []:
    pass
else:
    ans += min(ll)
print(ans)