#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100+5;
int a[5*N],b[N*N];
int main(){
freopen ("maxmul.in","r",stdin);
freopen ("maxmul.out","w",stdout);
int n,cnt=0;scanf("%d",&n);
for (int i=2;;i++){
if (n<i)break;
a[++cnt]=i;
n-=i;
}
while(n){
for (int i=cnt;i>=1&&n;i--){
a[i]++;n--;
}
}
for (int i=1;i<=cnt;i++)printf("%d ",a[i]);
printf("\n");
b[1]=1;int num=1;
for (int i=1;i<=cnt;i++){
int jw=0;
for (int j=1;j<=num;j++){
b[j]=b[j]*a[i]+jw;
jw=b[j]/10;
b[j]%=10;
}
if (jw){
while(jw){
b[++num]=jw%10;
jw/=10;
}
}
}
for (int i=num;i>=1;i--)printf("%d",b[i]);
printf("\n");
return 0;
}