#include using namespace std; int main(){ string n; cin >> n; cout << (1LL * n.size() + 1) * 9; }