#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n,ans=0;
    cin>>n;
    for (ll i=999,c=1;i<n;i=i*1000+999,++c)
        ans+=((min({i*1000+999,n})-i)*c);
    cout<<ans;
    return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main(){
	
	long long n; cin >> n;
	vector<long long> vec;
	
	for(int i=1; i <= sqrt(n); i++){
		if(n % i == 0){
			if(n /i == i){
				vec.push_back(i);
			}
			else{
				vec.push_back(i);
				vec.push_back(n/i);
			}
		}
	}
	sort(vec.begin(), vec.end());
	
	for(auto x : vec){
		cout << x << endl;
	}
	
	
	
}



