#include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp make_pair
#define pb push_back
#define fp first
#define sp second
typedef long long int ll;
typedef pair<ll,ll> pp;
#define check(x, i) ((x>>i)&1LL)
#define set(x,i) (x|(1LL<<i))
#define unset(x,i) (x&~(1LL<<i))
#define INF LONG_MAX
#define MAX_N 20
#define MAX 200005
#define mod 1000000007
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define len(i,s) for(i=0;s[i];i++)
#define T() ll t;cin>>t;while(t--)
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
ll gcd (ll a, ll b){return (a?gcd(b%a,a):b);}
ll pow1(ll a,ll b,ll MOD){ll ans=1;while(b!=0){if(b&1)ans=(ans*a)%MOD;a=(a*a)%MOD;b=b/2;}return ans;}
ll modInverse(ll a,ll p){return pow1(a,p-2,p);}


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


ll n;
cin>>n;
ll i,j;
ll arr[n-1];
REP(i,n-1)
{
	arr[i]=i+2;
}
ll ans = arr[0]; 
    for (int i = 1; i < n-1; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  

cout<<ans+1<<"\n";

}
#include <bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define forn(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, M;
	cin >> N;
	int d = 0;
	M = N;
	while (M > 0) {
		d++;
		M /= 10;
	}
	if (d == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (d % 2 != 0) {
		M = 0;
		for (int i = 0; i < d; i++) {
			M = 10 * M + 9;
		}
	} else {
		M = N;
	}
	vector<ll> c;
	while (M > 0) {
		c.push_back(M % 10);
		M /= 10;
	}
	reverse(c.begin(), c.end());
	ll R = 0;
	for (ui i = 0; i < c.size() / 2; i++)
		R = 10 * R + c[i];
	ll ans = R;
	for (ui i = 0; i < c.size() / 2; i++)
		R = 10 * R + c[i];
	// cout << R << "  " << N << endl;
	cout << ans - (R > N ? 1 : 0) << endl;		
}
