#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
#define ll long long 
#define lll __int128_t
#define pb push_back
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;
ll dp[20][2];
ll ans = 0;
ll recurse(vector<ll>&v , ll sz , string &s){
    if((ll)v.size() * 2==sz){
        for(int i = 0;i<sz;i++){
            if(v[i % (sz / 2)]>(s[i] - '0')){
                return 0;
            }
            else if(v[i % (sz / 2)] < (s[i] - '0')){
                return 1;
            }
        }
        return 1;
    }
    ll res = 0;
    if(v.empty()){
        for(ll i = 1;i<=9;i++){
            v.push_back(i);
            res += recurse(v , sz , s);
            v.pop_back();
        }
    }
    else{
        for(ll i = 0;i<=9;i++){
            v.push_back(i);
            res += recurse(v , sz , s);
            v.pop_back();
        }
    }
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    ll sz = s.size();
    ll i,j,k,l,n,m;
    ll gun = 1;
    for(i = 2;i<sz;i+=2){
        ans += (gun * 9);
        gun *= 10;
    }
    if(sz % 2 != 0){
        cout<<ans<<"\n";
        return 0;
    }
    ///cout<<ans<<"\n";
    vector<ll>kola;
    ans += recurse(kola , sz , s);
    cout<<ans<<"\n";
    return 0;
}
/*
 * @Author: zhl
 * @LastEditTime: 2020-12-05 20:02:46
 */
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;

int gcd(int a, int b) {
	return a % b == 0 ? b : gcd(b, a % b);
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
signed main() {
	int n; cin >> n;
	int ans = 1;
	for (int i = 2; i <= n; i++) {
		ans = lcm(ans, i);
	}
	cout << ans + 1 << endl;
}