#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int a[100005] , cur;
string cheng(string x, string y){
int a[1000005] = {} , b[1000005] = {} , c[2000005] = {};
for(int i = 1 , j = x.size() - 1;j >= 0;i++ , j--)a[i] = x[j] - '0';
for(int i = 1 , j = y.size() - 1;j >= 0;i++ , j--)b[i] = y[j] - '0';
for(int i = 1;i <= x.size();i++){
for(int j = 1;j <= y.size();j++){
c[i + j - 1] += a[i] * b[j];
c[i + j] += c[i + j - 1] / 10;
c[i + j - 1] %= 10;
}
}
int len = x.size() + y.size();
while(len > 1 && c[len] == 0)len--;
string s;
for(int i = len;i >= 1;i--)s += char(c[i] + '0');
return s;
}
int main(){
int n , sum = 0 , cnt = 0;
cin >> n;
if(n < 5){
cout << n << "\n" << n;
return 0;
}
for(int i = 2;;i++){
if(sum + i > n)break;
a[++cur] = i;
sum += i;
}
if(sum != n){
for(int i = cur;i >= 1;i--){
a[i]++;
cnt++;
if(cnt == n - sum)break;
}
}
string s = "1";
for(int i = 1;i <= cur;i++){
cout << a[i] << " ";
s = cheng(s , to_string(a[i]));
}
cout << '\n' << s;
return 0;
}