#include<iostream>
#include<cmath>

using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    ll N;
    cin >> N;

    int p=0;
    while(pow(10, p) <= N){
        p++;
    }
    
    ll ans=0;
    rep(i,p){
        if(i==p-1){
            ans += i/3*(N-pow(10,i)+1);
            continue;
        }
        ans += i/3*(pow(10, i+1)-pow(10,i));
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
#define outfile freopen("out.out", "w", stdout);
#define infile  freopen("in.in", "r", stdin);
typedef  long long     ll ;
using namespace std;
void M(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
using namespace std;

int main()
{
    M();
    string s;
    cin>>s;

    s.push_back(s[0]);
    for(int i=1 ; i<4 ; i++)cout<<s[i];
    return 0;
}
