只过了1,3,5.
#include<iostream>
using namespace std;
int n,i=1,j,cnt;
int b[600000];
int main(){
// freopen("pow.in","r",stdin);
// freopen("pow.out","w",stdout);
cin>>n;
if(n>30||n<9){
cout<<0<<endl;
return 0;
}
int a1,a2,a3,a4,a5,a6,a7,a8,a9,a10;
for(a1=1;a1<=3;a1++)
for(a2=1;a2<=3;a2++)
for(a3=1;a3<=3;a3++)
for(a4=1;a4<=3;a4++)
for(a5=1;a5<=3;a5++)
for(a6=1;a6<=3;a6++)
for(a7=1;a7<=3;a7++)
for(a8=1;a8<=3;a8++)
for(a9=1;a9<=3;a9++)
for(a10=1;a10<=3;a10++)
if(a1+a2+a3+a4+a5+a6+a7+a8+a9+a10==n){
b[i++]=a1;
b[i++]=a2;
b[i++]=a3;
b[i++]=a4;
b[i++]=a5;
b[i++]=a6;
b[i++]=a7;
b[i++]=a8;
b[i++]=a1;
b[i++]=a10;
cnt++;
}
if(cnt){
cout<<cnt<<endl;
for(i=0;i<cnt;i++){
for(j=1;j<=10;j++)
cout<<b[i*10+j]<<' ';
cout<<endl;
}
}
else
cout<<0<<endl;
return 0;
}