function Main(input) {
    const numStr = input;
    const num = parseInt(numStr,10);
    var count = 0;
    var keta = numStr.length;
    switch(keta){
        case 1:
        count = num;
        break;
        case 2:
        count = 9;
        break;
        case 3:
        count = num - 90;
        break;
        case 4:
        count = 909;
        break;
        case 5:
        count = num - 9090;
        break;
        case 6:
        default:
        count = 90909;
        break;
    }

    console.log(count);
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));