import java.util.*;
 
public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  }
} import java.util.*; util.* java public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  }
} Main public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  } main {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int sum = 0; sum 0 if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    } N >= 1 && N < 10 N >= 1 N 1 N < 10 N 10 {
      sum += N;
    } sum += N sum N if (N >= 10){
      sum += 9;
    } N >= 10 N 10 {
      sum += 9;
    } sum += 9 sum 9 if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    } N/100 >= 1 && N/100 < 10 N/100 >= 1 N/100 N 100 1 N/100 < 10 N/100 N 100 10 {
      sum += N - 99;
    } sum += N - 99 sum N - 99 N 99 if (N/100 >= 10){
      sum += 900;
    } N/100 >= 10 N/100 N 100 10 {
      sum += 900;
    } sum += 900 sum 900 if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    } N/10000 >= 1 && N/10000 < 10 N/10000 >= 1 N/10000 N 10000 1 N/10000 < 10 N/10000 N 10000 10 {
      sum += N - 9999;
    } sum += N - 9999 sum N - 9999 N 9999 if (N/10000 == 10){
      sum += 90000;
    } N/10000 == 10 N/10000 N 10000 10 {
      sum += 90000;
    } sum += 90000 sum 90000 System.out.println(sum) System.out.println System.out System System.out sum String[] arg arg public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  }
} public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  }
} Main
import java.util.*;
 
public class Main {
  public static void main (String[] arg) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int sum = 0;
    
    if(N >= 1 && N < 10){
      sum += N;
    } else if (N >= 10){
      sum += 9;
    }
    
    if(N/100 >= 1 && N/100 < 10){
      sum += N - 99;
    } else if (N/100 >= 10){
      sum += 900;
    }
    
    if(N/10000 >= 1 && N/10000 < 10){
      sum += N - 9999;
    } else if (N/10000 == 10){
      sum += 90000;
    }
    System.out.println(sum);
  }
}