# include <queue>
# include <cstdio>
# include <cstring>
# include <iostream>
# include <algorithm>
using namespace std; int v[4] = {1,10,100,1000},a[100000]; struct BigNumber{
int d[1000];
BigNumber() { memset(d,0,sizeof(d)); d[0] = 1; }
BigNumber operator =(const int b){
char s[40];
sprintf(s,"%d",b);
int len = strlen(s);
memset(d,0,sizeof(d));
d[0] = (len - 1)/4 + 1;
for(int i = 0;i < len;i++) d[(len-i-1)/4+1] += (s[i]-'0')*v[(len-i-1)%4];
return *this;
}
void put(){
printf("%d",d[d[0]]);
for(int i = d[0]-1;i >= 1;i--) printf("%04d",d[i]);
printf("\n");
}
}; BigNumber operator * (const BigNumber &a,const int &k)
{
BigNumber c;
c.d[0] = a.d[0];
int i ,x = 0;
for(int i = 1;i <=a.d[0];i++){
x = a.d[i]*k + x;
c.d[i] = x%10000;
x /= 10000;
}
while(x > 0){
c.d[++c.d[0]] = x%10000;
x /= 10000;
}
while((c.d[0]>1) && (c.d[c.d[0]] == 0)) --c.d[0];
return c;
} int main()
{
//freopen("a.txt","r",stdin);
//freopen("b.txt","r",stdin);
__int64 n,i;
while(~scanf("%I64d",&n)){
BigNumber ans;
ans = 1;
if(n <= 4){
printf("%d\n",n); continue;
}
//算出n的连续和;
for(i = 2;i < n;i++){
a[i-2] = i;
n -= i;
} int cnt = i - 3;
while(n){
a[cnt]++;
n--;
cnt -= 1;
if(cnt == -1) cnt = i - 3;
}
for(int j = 0;j <= i - 3;j++){
//printf("%d ",a[j]);
ans = ans * a[j];
}
ans.put();
}
return 0;
}