include <bits/stdc++.h>
using namespace std;
int dp[55];
int f(int x)
{
if(dp[x]!=-1) return dp[x];
return dp[x]=f(x-1)+f(x-2)*2;//别和数学的弄混了
}
int main()
{
int n;
while(cin>>n)
{
memset(dp,-1,sizeof(dp));
dp[0]=0;dp[1]=3;dp[2]=6;dp[3]=6;
cout<<f(n)<<endl;
}
}