#include <iostream> #include <vector> using namespace std; int main() { int n; scanf("%d", &n); int cnt = 0; long long arr[10000][10] = { 0 }; int index_x = 0; for (int a = 1; a <= 3; a++) { for (int b = 1; b <= 3; b++) { for (int c = 1; c <= 3; c++) { for (int d = 1; d <= 3; d++) { for (int e = 1; e <= 3; e++) { for (int f = 1; f <= 3; f++) { for (int g = 1; g <= 3; g++) { for (int h = 1; h <= 3; h++) { for (int j = 1; j <= 3; j++) { for (int k = 1; k <= 3; k++) { if ((a + b + c + d + e + f + g + h + j + k) == n) { cnt++; arr[index_x][0] = a; arr[index_x][1] = b; arr[index_x][2] = c; arr[index_x][3] = d; arr[index_x][4] = e; arr[index_x][5] = f; arr[index_x][6] = g; arr[index_x][7] = h; arr[index_x][8] = j; arr[index_x][9] = k; index_x++; } } } } } } } } } } } printf("%d\n", cnt); if (cnt > 0) { for (int i = 0; i < cnt; i++) { for (int j = 0; j < 10; j++) { printf("%d ", arr[i][j]); } printf("\n"); } } return 0; }