#include<iostream>
using namespace std;
int main ()
{
int n;
cin>>n;
int c = 1;
int s = 1;
while(c<=n)
{
s = s * 3;
c++
}
cout<<s;
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x=1;
while (x<=2000)
{
if(x%3==2 && x%5==3&&x%7==2)
{
cout<<x<<endl;
}
x++;
}
return 0;
}