
/*
			Saturday 13 March 2021 05:51:34 PM IST
					@uthor::astrainL3gi0N
*/

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

typedef long long int ll;
typedef std::vector<int> vi;
typedef std::vector<ll> vll;
typedef std::pair<int,int> ii;
#define debg(x)	std::cerr<<(#x)<<" => "<<x<<'\n';
#define debgg(x,y)	std::cerr<<(#x)<<" => "<<x<<'\t'<<(#y)<<' '<<y<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()
const int mod = 1'0000'0000'7;
//const int mod = 998244353;
//cout.unsetf(ios::floatfield);cout.precision(10);cout.setf(ios::fixed,ios::floatfield);

bool comp (int x, int y) {
    return x > y;
}
void printarr (int arr[], int n) {
    for(int i = 0; i < n; ++i)
        std::cerr<<arr[i]<<(i<n-1?' ':'\n');
}
template < typename T> void  printv (T &a) {
    for (auto it = a.begin(); it != a.end(); ++it)
        std::cerr<<*it<<' ';
    std::cerr<<'\n';
}
    

const int maxn = 200009;
//int t[510][510];
ll ans;
int arr[maxn];

ll calcnum (ll n)
{
    ll p1 = pow(10,n)-1;
    ll p2 = pow(10,n-1);
    return p1-p2+1;
}


void solve ()
{
    bool ok = false;
    ll n,m,k,q;  std::cin>>n;
    ans = 0;

    ll num = n;

    int d = 0;
    while (num > 0)
        num /= 10, d++;

    for (int i = 1; i < d; ++i)
        ans += ((i-1)/3) * (calcnum(i));
    ans += (n - (ll)pow(10,d-1) + 1)*((d-1)/3);

    std::cout<<ans;
    std::cout<<'\n';
}
void sol ()
{
    //test
}

int main ()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
        solve();
    return 0;
}

#include <bits/stdc++.h>
using namespace  std;
int main(){
  int n,ans=0;
  cin >> n;
  for(int i= 1;i <= n;i ++){
    int p = n-i;
    if(p > 0)ans ++;
  }
  cout <<ans;
  return 0;
}