#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <iterator>
#include <functional>
#include <numeric>
#include <complex>
#include <valarray>
#include <cmath>
#include <string>
#include <regex>
#include <ctime>
#include <chrono>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <future>
#include <atomic>
#include <memory>
#include <new>
#include <type_traits>
#include <typeinfo>
#include <exception>
#include <stdexcept>
#include <cstdio>
#include <cstdint>
#include <utility>
#include <random>
#include <locale>
#include <codecvt>
#include <cassert>
#include <cctype>
#include <cstring>
#include <cwchar>
#include <climits>
#include <cfloat>
#include <cstdlib>
using namespace std;
#define endl '\n'
#define int long long
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef unsigned long long ull ;
typedef long long ll ;
typedef pair<int, int>PII;
void solve(){
int n;
cin>>n;
if(n<10) {
cout<<n+1;
return ;
}
if(n==10){
cout<<10;
return ;
}
//计算位数算法需优化
int x = n;
int a = 1, b = 1;
int t = 1;
while(x/10){
a=x/10;
t++;
if(x/100==0&&x/10!=0){
b=x%10;
}
x/=10;
}
int ans;
if(a<=b) ans = a*t+*(t-1);
else ans = (a-1)*t+(11-a)*(t-1);
cout<<ans;
}
signed main(){
IOS;
int tt;
tt=1;
//cin>>tt;
while(tt--)
solve();
return 0;
}