#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=14449999999999999; ll mod=998244353; ll modpow(ll x, ll n) { if(n==0) return 1; //再帰の終了条件 else if(n%2==1) { return (x*modpow(x, n-1)); //nが奇数ならnを1ずらす } else return modpow((x*x), n/2); //nが偶数ならnが半分になる } int main(){ ll n; cin >> n; if (n==1) { cout << 2 << endl; return 0; }else if (n==2) { cout << 3 << endl; return 0; } ll ans=n-1; vectory(2000000,1); for (ll i = 1; i <=43; i++) { for (ll j = 2; j <=ans; j++) { if (j>=y.size()) { break; } y[j]*=j; y[j]+=1; if (y[j]>n) { break; } if (n%y[j]==0&&n/y[j]