#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
int main(){
int n,ans=0,cnt=10;
cin>>n;
rep(a,1,3) rep(b,1,3) rep(x,1,3) rep(y,1,3) rep(n,1,3)
rep(m,1,3) rep(a1,1,3) rep(b1,1,3) rep(x1,1,3) rep(y1,1,3)
if (a+b+x+y+n+m+a1+b1+x1+y1==n)
ans++;
cout<<ans<<endl;
rep(a,1,3) rep(b,1,3) rep(x,1,3) rep(y,1,3) rep(n,1,3)
rep(m,1,3) rep(a1,1,3) rep(b1,1,3) rep(x1,1,3) rep(y1,1,3)
if (a+b+x+y+n+m+a1+b1+x1+y1==n)
cout<<a<<" "<<b<<" "<<x<<" "<<y<<" "<<n<<" "<<m<<" "<<a1<<" "<<b1<<" "<<x1<<" "<<y1<<endl;
return 0;
}