# 20. 出租车计费

20

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function(str)) {
    let ans = 0;
    for(let i=0; i<str.length; i++) {
        let dight = parseInt(str[i]);
        if (dight > 4) {
            dight--;
        }
        ans = ans * 9 + dight;
    }
    console.log(ans);
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18