T = [int(input()) for _ in range(5)]

ans, remainder = 0, 10
for t in T:
    if t % 10 != 0:
        ans += (t // 10) * 10 + 10
        remainder = min(t % 10, remainder)
    else:
        ans += t
print(ans + (remainder % 10 - 10))
