//题意自己看,不懂度娘
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string.h>
using namespace std;
int main(int argc, char *argv[])
{
int m;
long long int a[10005]={0};
a[0]=0;
a[1]=2;
long long int gg=0;
for(int i=2;i<=36;i++)
{
a[i]=3*a[i-1]+2;//递归公式
//printf("%lld\n",a[i]);
}
while(scanf("%d",&m)!=EOF)
{
gg=a[m];
printf("%lld\n",gg);
}
return 0;
}
//Start-ZJ
//2017/12/14/10:40