/*

    P_r_A_d_Y ☹

*/
#include<bits/stdc++.h>
using namespace std;

#define int     long long int
#define endl    "\n"
#define mod     1000000007
#define inf     1e18
#define pb      push_back
#define all(x)  x.begin(),x.end()
#define arr_max(x)  *max_element(x.begin(),x.end())
#define arr_min(x)  *min_element(x.begin(),x.end())
#define pii         pair<int,int>
#define ff          first
#define ss          second
#define vec         vector<int>

const int N = 200005;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);


bool cmp(vector<int>a , vector<int>b) {
    return a[0] < b[0];
}
int poww(int x, int n)
{
    if (n == 0 ) return 1 ;
    int u = poww(x, n / 2);
    u = (u * u) ;
    if (n % 2 == 1)u = (u * x) ;
    return u;
}

//(x**n)%m
int mod_pow(int x, int n, int m)
{
    if (n == 0 ) return 1 % m;
    int u = mod_pow(x, n / 2, m);
    u = (u * u) % m;
    if (n % 2 == 1)u = (u * x) % m;
    return u;
}
int query(int l, int r)
{
    int x;
    cout << "? " << l << " " << r << endl;
    cout.flush();
    cin >> x;
    cout.flush();

    return x;
}

int xd[4] = {1, 0, -1, 0};
int yd[4] = {0, -1, 0, 1};
int ceil(int a, int d)
{
    return (a % d ? a / d + 1 : a / d);
}


int32_t main()
{
    fastIO;

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    int test;
    test = 1;
    //cin >> test;
    int ert = 1;
    while (test--)
    {

        int n; cin >> n;

        int d = 0;
        int dup = n;
        while (dup > 0)
        {
            d++;
            dup /= 10;
        }

        int ans = 0;
        for (int i = 4; i < d; i++)
        {
            int g = (i - 1) / 3;
            ans += g * (9 * poww(10, i - 1));
        }

        int f = (d - 1) / 3;
        ans += f * (n - poww(10, d - 1) + 1);
        cout << ans << endl;

    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

using ll=long long;
ll mod=1000000007;

int main(){
    ll N,ans=0,K=1000;
    cin >> N;
    while(N-K+1>=0){
        ans+=N-K+1;
        K*=1000;
    }
    cout << ans << endl;
}