import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigDecimal; BigDecimal java.math import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    }

} Main public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    } main {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    } BigDecimal x1 = new BigDecimal("1"); x1 new BigDecimal("1") BigDecimal y = new BigDecimal("30"); y new BigDecimal("30") BigDecimal z = new BigDecimal("10"); z new BigDecimal("10") BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR); z4 x1.divide(y, 5, BigDecimal.ROUND_FLOOR) x1.divide x1 y 5 BigDecimal.ROUND_FLOOR BigDecimal BigDecimal.ROUND_FLOOR BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR); z5 x1.divide(z, 5, BigDecimal.ROUND_FLOOR) x1.divide x1 z 5 BigDecimal.ROUND_FLOOR BigDecimal BigDecimal.ROUND_FLOOR BigDecimal z1 = new BigDecimal("1"); z1 new BigDecimal("1") BigDecimal z6 = z1.add(z4); z6 z1.add(z4) z1.add z1 z4 InputStreamReader is = new InputStreamReader(System.in); is new InputStreamReader(System.in) BufferedReader reader = new BufferedReader(is); reader new BufferedReader(is) List<String> mylist = new ArrayList<>(); mylist new ArrayList<>() String strinput = reader.readLine(); strinput reader.readLine() reader.readLine reader while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        } strinput != null strinput null {

            mylist.add(strinput);
            strinput = reader.readLine();

        } mylist.add(strinput) mylist.add mylist strinput strinput = reader.readLine() strinput reader.readLine() reader.readLine reader String arr01[] = mylist.get(0).split(" "); arr01 mylist.get(0).split(" ") mylist.get(0).split mylist.get(0) mylist.get mylist 0 " " String n = arr01[0]; n arr01[0] arr01 0 int l = n.length(); l n.length() n.length n switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        } l case 1: 1 case 1: System.out.println(Integer.valueOf(n)) System.out.println System.out System System.out Integer.valueOf(n) Integer.valueOf Integer n break; case 2: 2 case 2: System.out.println(9 - 1 + 1) System.out.println System.out System System.out 9 - 1 + 1 9 - 1 9 1 1 break; case 3: 3 case 3: System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1) System.out.println System.out System System.out 9 - 1 + 1 + Integer.valueOf(n) - 100 + 1 9 - 1 + 1 + Integer.valueOf(n) - 100 9 - 1 + 1 + Integer.valueOf(n) 9 - 1 + 1 + Integer.valueOf(n) 9 - 1 9 1 1 Integer.valueOf(n) Integer.valueOf Integer n 100 1 break; case 4: 4 case 4: System.out.println(9 - 1 + 1 + 999 - 100 + 1) System.out.println System.out System System.out 9 - 1 + 1 + 999 - 100 + 1 9 - 1 + 1 + 999 - 100 9 - 1 + 1 + 999 9 - 1 + 1 + 999 9 - 1 9 1 1 999 100 1 break; case 5: 5 case 5: System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1) System.out.println System.out System System.out 9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1 9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) 9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) 9 - 1 + 1 + 999 - 100 9 - 1 + 1 + 999 9 - 1 + 1 + 999 9 - 1 9 1 1 999 100 1 Integer.valueOf(n) Integer.valueOf Integer n 10000 1 break; case 6: 6 case 6: System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1) System.out.println System.out System System.out 9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1 9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 9 - 1 + 1 + 999 - 100 + 1 + 99999 9 - 1 + 1 + 999 - 100 + 1 + 99999 9 - 1 + 1 + 999 - 100 9 - 1 + 1 + 999 9 - 1 + 1 + 999 9 - 1 9 1 1 999 100 1 99999 10000 1 break; String[] args args public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    }

} public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");

        String n = arr01[0];
        int l = n.length();

        switch (l) {
        case 1:
            System.out.println(Integer.valueOf(n));
            break;
        case 2:

            System.out.println(9 - 1 + 1);
            break;
        case 3:
            System.out.println(9 - 1 + 1 + Integer.valueOf(n) - 100 + 1);

            break;
        case 4:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1);
            break;
        case 5:
            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + Integer.valueOf(n) - 10000 + 1);

            break;
        case 6:

            System.out.println(9 - 1 + 1 + 999 - 100 + 1 + 99999 - 10000 + 1);
            break;

        }

    }

}