#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, i;
    unsigned long long pr=1;
    cin>>n;
    for(i=1; i*i<n; i++){
        pr *= i;
    }
    pr /= i-1;
    cout<<n / pr * pr + 1<<endl;
    return 0;
}
