N = int(eval(input()))



ans = sum(len(str(i)) % 2 == 1 for i in range(1, N + 1))



print(ans)

N = int(eval(input()))



ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999)



print(ans)

N = int(eval(input()))
ans = sum(len(str(i)) % 2 == 1 for i in range(1, N + 1))
print(ans)

N = int(eval(input()))
ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999)
print(ans)

-ans = sum(len(str(i)) % 2 == 1 for i in range(1, N + 1)) +ans = min(9, N) + max(0, min(999, N) - 99) + max(0, min(99999, N) - 9999)