import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int a = (int)Math.pow(10, 5) - 10000; a (int)Math.pow(10, 5) - 10000 (int)Math.pow(10, 5) Math.pow Math 10 5 10000 int b = (int)Math.pow(10, 3) - 100; b (int)Math.pow(10, 3) - 100 (int)Math.pow(10, 3) Math.pow Math 10 3 100 int c = (int)Math.pow(10, 1) - 1; c (int)Math.pow(10, 1) - 1 (int)Math.pow(10, 1) Math.pow Math 10 1 1 int length = String.valueOf(n).length(); length String.valueOf(n).length() String.valueOf(n).length String.valueOf(n) String.valueOf String n if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        } length == 6 length 6 {
            System.out.println(a + b + c);
        } System.out.println(a + b + c) System.out.println System.out System System.out a + b + c a + b + c a b c if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        } length == 5 length 5 {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c) System.out.println System.out System System.out (n - (int)Math.pow(10, 4) + 1) + b + c (n - (int)Math.pow(10, 4) + 1) + b + c (n - (int)Math.pow(10, 4) + 1) n - (int)Math.pow(10, 4) n (int)Math.pow(10, 4) Math.pow Math 10 4 1 b c if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        } length == 4 length 4 {
            System.out.println(b + c);
        } System.out.println(b + c) System.out.println System.out System System.out b + c b c if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        } length == 3 length 3 {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } System.out.println((n - (int)Math.pow(10, 2) + 1) + c) System.out.println System.out System System.out (n - (int)Math.pow(10, 2) + 1) + c (n - (int)Math.pow(10, 2) + 1) n - (int)Math.pow(10, 2) n (int)Math.pow(10, 2) Math.pow Math 10 2 1 c if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        } length == 2 length 2 {
            System.out.println(c);
        } System.out.println(c) System.out.println System.out System System.out c {
            System.out.println(n);
        } System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = (int)Math.pow(10, 5) - 10000;
        int b = (int)Math.pow(10, 3) - 100;
        int c = (int)Math.pow(10, 1) - 1;
        int length = String.valueOf(n).length();
        if (length == 6) {
            System.out.println(a + b + c);
        } else if (length == 5) {
            System.out.println((n - (int)Math.pow(10, 4) + 1) + b + c);
        } else if (length == 4) {
            System.out.println(b + c);
        } else if (length == 3) {
            System.out.println((n - (int)Math.pow(10, 2) + 1) + c);
        } else if (length == 2) {
            System.out.println(c);
        } else {
            System.out.println(n);
        }
    }
}