import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int i = 10, res = 0, sign = 1;
        while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        }
        if (res <= 0) res += A;
        System.out.println(res);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int i = 10, res = 0, sign = 1;
        while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        }
        if (res <= 0) res += A;
        System.out.println(res);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int i = 10, res = 0, sign = 1;
        while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        }
        if (res <= 0) res += A;
        System.out.println(res);
    } main {
        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int i = 10, res = 0, sign = 1;
        while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        }
        if (res <= 0) res += A;
        System.out.println(res);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int A = in.nextInt(); A in.nextInt() in.nextInt in int i = 10 i 10 res = 0 res 0 sign = 1; sign 1 while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        } A >= i A i {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        } res += (i - 1) * sign res (i - 1) * sign (i - 1) i 1 sign sign *= -1 sign -1 1 i *= 10 i 10 if (res <= 0) res += A; res <= 0 res 0 res += A res A System.out.println(res) System.out.println System.out System System.out res String[] args args
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int i = 10, res = 0, sign = 1;
        while (A >= i) {
            res += (i - 1) * sign;
            sign *= -1;
            i *= 10;
        }
        if (res <= 0) res += A;
        System.out.println(res);
    }
}