#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;
ll mmod= 998244353;



int main(){
  ll d=1;
  ll k;
  cin >> k;
  for(ll i=2;i<=k;i++)d=d/__gcd(d,i)*i;
  d++;
  cout << d << endl;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;

#define what_is(x)      cerr<<#x<<" is "<<x<<"\n";
#define read(x)         freopen("in.txt","r",stdin);
#define write(x)        freopen("out.txt","w",stdout);
#define Fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define mod             1e9+7
#define sz              3000005

map< char , int > mpp;

void solve(){

    ll res=0;
    string s;
    cin>>s;

    int len=s.size();
    mpp[s[len-1]]++;
    mpp[s[len-2]]++;

    for(int i=len-3; i>=0; i--){
        mpp[s[i]]++;
        if(s[i]==s[i+1] && s[i]!=s[i+2]){
            res+=(len-i-mpp[s[i]]);
            mpp.clear();
            mpp[s[i]]=len-i;
        }
    }

    cout<<res<<endl;
}

int main(){
    Fast;///using Fast I/O
    
    //read(x); write(x);

    int multitest=0;
    if(multitest){
        int tc;
        cin>>tc;
        while(tc--)
            solve();
    }
    else
        solve();

    return 0;
}

