public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long N=scanner.nextLong(); String S= String.valueOf(N); int nm=S.length(); long ans= 0L; for (long f = 1,i=1, b = 1; i <= nm; i++) { f *=10; long flag=N/b%10; if (flag>1){ ans+=(N/f+1)*b; }else if (flag==1){ ans+=N/f*b+N%b+1; }else { ans+=N/f*b; } b *=10; } System.out.println(ans); } }