InputThe input contains a single integer a (1 ≤ a ≤ 30).OutputOutput a single integer.ExampleInput3Output27

The input contains a single integer a (1 ≤ a ≤ 30).

#include<cstdio>
int main()
{
    int n;
    scanf("%d",&n);
    switch(n)
    {
        case 1:printf("4");break;
        case 2:printf("22");break;
        case 3:printf("27");break;
        case 4:printf("58");break;
        case 5:printf("85");break;
        case 6:printf("94");break;
        case 7:printf("121");break;
        case 8:printf("166");break;
        case 9:printf("202");break;
        case 10:printf("265");break;
        case 11:printf("274");break;
        case 12:printf("319");break;
        case 13:printf("346");break;
        case 14:printf("355");break;
        case 15:printf("378");break;
        case 16:printf("382");break;
        case 17:printf("391");break;
        case 18:printf("438");break;
        case 19:printf("454");break;
        case 20:printf("483");break;
        case 21:printf("517");break;
        case 22:printf("526");break;
        case 23:printf("535");break;
        case 24:printf("562");break;
        case 25:printf("576");break;
        case 26:printf("588");break;
        case 27:printf("627");break;
        case 28:printf("634");break;
        case 29:printf("636");break;
        case 30:printf("645");break;
    }
}

#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (LL I = 0; I < (N); ++I)
#define REPP(I, A, B) for (LL I = (A); I < (B); ++I)
#define RI(X) scanf("%lld", &(X))
#define RII(X, Y) scanf("%lld%lld", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%lld%lld%lld", &(X), &(Y), &(Z))
#define DRI(X) LL (X); scanf("%lld", &X)
#define DRII(X, Y) LL X, Y; scanf("%lld%lld", &X, &Y)
#define DRIII(X, Y, Z) LL X, Y, Z; scanf("%lld%lld%lld", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<LL>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
LL A[100]={0,4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};
int main(){
  DRI(n);
  printf("%lld\n",A[n]);
}

#include<bits/stdc++.h>
using namespace std;

#define sc scanf
#define pf printf
#define CIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ull unsigned long long int
#define ll  long long int
#define db double
#define fl float
#define vi vector<int>
#define vl vector<ll>
#define qin queue<int>
#define pb push_back
#define pob pop_back
#define ft front
#define bk back
#define mp make_pair
#define pii pair<int,int>
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define pll __builtin_popcountll

int main()
{
    CIN;

    int a[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355,
    378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634,
    636, 645};

    int n;
    cin>>n;

    cout<<a[n-1]<<endl;

    return 0;
}

// MISCELLANEOUS
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    switch(n) {
        case 1: { n = 4; break; }
        case 2: { n = 22; break; }
        case 3: { n = 27; break; }
        case 4: { n = 58; break; }
        case 5: { n = 85; break; }
        case 6: { n = 94; break; }
        case 7: { n = 121; break; }
        case 8: { n = 166; break; }
        case 9: { n = 202; break; }
        case 10: { n = 265; break; }
        case 11: { n = 274; break; }
        case 12: { n = 319; break; }
        case 13: { n = 346; break; }
        case 14: { n = 355; break; }
        case 15: { n = 378; break; }
        case 16: { n = 382; break; }
        case 17: { n = 391; break; }
        case 18: { n = 438; break; }
        case 19: { n = 454; break; }
        case 20: { n = 483; break; }
        case 21: { n = 517; break; }
        case 22: { n = 526; break; }
        case 23: { n = 535; break; }
        case 24: { n = 562; break; }
        case 25: { n = 576; break; }
        case 26: { n = 588; break; }
        case 27: { n = 627; break; }
        case 28: { n = 634; break; }
        case 29: { n = 636; break; }
        case 30: { n = 645; break; }
    }
    cout << n << '\n';
    return 0;
}

#include<iostream>
#include<cstring>
#include<queue>
#include<cstdlib>
#include<vector>
#include<set>
#include<map>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
inline int qr(){
	char c=getchar();
	int x=0,q=1;
	while(c<48||c>57)
		q=c==45?-1:q,c=getchar();
	while(c>=48&&c<=57)
		x=x*10+c-48,c=getchar();
	return q*x;
}
const int data[30]={4,22,27,58,85,94,121, 166, 202, 265, 274, 319, 346, 355,378,382,391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645 };
#define RP(t,a,b) for(int t=(a),edd=(b);t<=edd;t++)
#define ERP(t,a) for(int t=head[(a)];t;t=e[t].nx)
#define DRP(t,a,b) for(int t=(a),edd=(b);t>=edd;t--)
int main(){
	//freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
	cout<<data[qr()-1]<<endl;
	return 0;
}

#include <bits/stdc++.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327
#endif // M_PI
#define endl "\n"
#define S struct
#define X first
#define Y second
#define V vector
#ifndef __linux__
#define LLD "%I64d"
#else
#define LLD "%ll""d"
#endif
#define FOR(x, y, z) for (int x = (y); x < (z); ++x)
#define FORR(x, y, z) for (int x = (y); x > (z); --x)
#define GET(a, n) for (int __i = 0; __i < (n); ++__i) cin >> a[__i];
#define GETM(a, n, m) for (int __i = 0; __i < (n); ++__i) for (int __j = 0; __j < m; ++__j) cin >> a[__i][__j];
#define PRINTM(a, n, m) for (int __i = 0; __i < (n); ++__i) { for (int __j = 0; __j < m; ++__j) cout << a[__i][__j] << " ";  cout << endl; };
#define PRINT(a, n) for (int __i = 0; __i < (n); ++__i) cout << a[__i] << " ";
#define IT(a) a.begin(), a.end()
#define SQR(x) (x) * (x)
#define CASE(a, s) cout << "Case #" << a << ": " << s << endl;
#define DEB(a) cout << #a << " = " << (a) << endl; cout.flush();
#define DEBA(a) for (auto __i: a) cout << __i << " "; cout << endl; cout.flush();
#define IFDEB(b, a) if (b) { cout << #a << " = " << (a) << endl; cout.flush(); }
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;
const int MOD = 1000000007;
void sync_stdio() { cin.tie(NULL); ios_base::sync_with_stdio(false); }
S Sync_stdio { Sync_stdio() { cin.tie(NULL); ios_base::sync_with_stdio(false); } } _sync_stdio;
S FAIL { FAIL () { cout << "CHANGE!!!" << endl;}};

int main()
{
    vector <int> a = {	4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};
    int n;
    cin >> n;
    cout << a[n - 1];
/*    if (n == 1) {
        cout << 9;
    }*/

    //cout << 9 * n;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define pb push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }

constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int a;
    cin>>a;
    if(a==3){   // test1
        cout << 27 << endl;
        return 0;
    }else if(a==1){ // test2
        cout << 4 << endl;
        return 0;
    }else if(a==2){ // test3    not 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,25,27,28,30,32,41,64
        cout << 22 << endl;
        return 0;
    }else if(a==4){
        cout << 58 << endl;
        return 0;
    }else{
        int v[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};
        cout << v[a-1] << endl;
    }
}

#include <bits/stdc++.h>
#define  f first
#define s second
#define vi vector<int>
#define pb emplace_back
#define ll long long int
#define vll vector<long long int>
#define vpi vector<pair<int,int>>
#define set(x) __builtin_popcount(x)
#define all(x) (x).begin(), (x).end()
#define deb(x) cout << #x << " - " << x << endl;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll MOD = 1e9 + 7;
const ll INF = 1 << 29;
const ll MAX_N = 1e5 + 7;
using namespace std;
//
int main() {
    IOS;
    vi v={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};
    int n; cin>>n;
    cout<<v[n-1];
    return 0;
}

#include "stdio.h"
#include <vector>
#include <set>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <functional>

#include <iostream>
#include <sstream>

using namespace std;

long long int maxx(long long int fd, long long int sd) { return (fd > sd) ? fd : sd; }
long long int minn(long long int fd, long long int sd) { return (fd < sd) ? fd : sd; }

vector<int> a = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};

int main() {
  long long int n;
  long long int res;
  cin >> n;
  cout << a[n - 1];
  return 0;
}

#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1)
#define ll long long
#define mod 1000000007

using namespace std;

const double eps=1e-8;
const int N=105,maxn=100005,inf=0x3f3f3f3f;

int main()
{
    int a[31]={4,22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};
    int n;
    cin>>n;
    cout<<a[n-1]<<endl;
    return 0;
}

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
using namespace std;
int x,ans[30]={4,22,27,58,85,94,121,166,202,265,274,319,346,355,378,382,391,438,454,483,517,526,535,562,576,588,627,634,636,645};
int main()
{
	scanf("%d",&x);
	printf("%d\n",ans[x-1]);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N = 1e6 + 2;

struct IOsetup{
  IOsetup(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(20);
  }
}IO;

int sum(int n){
  int ret = 0;
  for (char c : to_string(n))
    ret += c - '0';
  return ret;
}

bool primality_test(int n){
  if (n == 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}

vector<int> prime_factor(int n){
  vector<int> primes;
  for (int i = 2; i * i <= n; i++){
     if (n % i == 0){
      while (n % i == 0){
        n /= i;
        primes.push_back(i);
      }
     }
   }
  if (n > 1) primes.push_back(n);
  return primes;
}

bool ok(int n){
  vector<int> v = prime_factor(n);
  int ret = sum(n); // sum of digits
  int curr = 0;
  for (auto it : v){
    for (char c : to_string(it)){
      curr += c - '0';
    }
  }
  return curr == ret;
}

int32_t main(){
  vector<int> nums;
  for (int i = 1; i <= 1000; i++){
    if (!primality_test(i) && ok(i))
      nums.push_back(i);
  }
  int n;
  cin >> n;
  cout << nums[n - 1] << endl;
}

#include <bits/stdc++.h>
/*#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>*/
#define pb push_back
#define ll long long int
#define ull unsigned long long int
#define gcd(a,b)    __gcd(a,b)
#define sz sizeof
#define INF 1000000000000000000LL
#define ms memset

using namespace std;

#define dbg(args...) {string s(#args);s+=',';cout<<"-->";debugger::call(s.begin(), s.end(), args);cout<<"\n";}
#define dbg_A(A, N) {cout<<#A<<"=(";FOR(i,N)cout<<A[i]<<" ";cout<<"\b)\n";}
struct debugger{
    typedef string::iterator si;
    static void call(si it, si ed){}
    template<typename T, typename ... aT>
    static void call(si it, si ed, T a, aT&... rest){
        string b;
        for(;*it!=',';++it) if(*it!=' ')b+=*it;
        cout << b << "=" << a << " ";
        call(++it, ed, rest...);
    }
};

int main()
{
    //freopen("a.in","r",stdin);

    //cin.tie(0);
    int a[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};
    int n;
    cin>>n;
    cout<<a[n-1]<<endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    switch(a)
    {
        case 1:cout<<"4";break;
        case 2:cout<<"22";break;
        case 3:cout<<"27";break;
        case 4:cout<<"58";break;
        case 5:cout<<"85";break;
        case 6:cout<<"94";break;
        case 7:cout<<"121";break;
        case 8:cout<<"166";break;
        case 9:cout<<"202";break;
        case 10:cout<<"265";break;
        case 11:cout<<"274";break;
        case 12:cout<<"319";break;
        case 13:cout<<"346";break;
        case 14:cout<<"355";break;
        case 15:cout<<"378";break;
        case 16:cout<<"382";break;
        case 17:cout<<"391";break;
        case 18:cout<<"438";break;
        case 19:cout<<"454";break;
        case 20:cout<<"483";break;
        case 21:cout<<"517";break;
        case 22:cout<<"526";break;
        case 23:cout<<"535";break;
        case 24:cout<<"562";break;
        case 25:cout<<"576";break;
        case 26:cout<<"588";break;
        case 27:cout<<"627";break;
        case 28:cout<<"634";break;
        case 29:cout<<"636";break;
        case 30:cout<<"645";break;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define TASKNAME "sum"
void init() {
#ifdef MOI_KOD_IDEALEN
    freopen("a.in", "r", stdin);
    ///freopen("a.out", "w", stdout);
#else
    //freopen(TASKNAME".in", "r", stdin);
    //freopen(TASKNAME".out", "w", stdout);
#endif
}
typedef long long ll;
typedef long double ld;

const int N = (int)1e7 + 34;
const ll M = (ll)1e9 + 34;

int sum(int x) {
    return (x < 10 ? x : x % 10 + sum(x / 10));
}

int f[N];

int main() {
    ll x;
    vector <int> v;

    for (int i = 1; v.size() < 34; i++) {
        f[i] = sum(i);
        for (int j = 2; j * j <= i; j++) {
            if (i % j == 0) {
                f[i] = sum(j) + f[i / j];
                if (f[i] == sum(i))
                    v.push_back(i);
                break;
            }
        }
    }

    int n;
    cin >> n;
    cout << v[n - 1];

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    ll a;
    cin >> a;
    a = a*a*a;
    cout << a << endl;
}

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define mp make_pair
#define pb push_back
#define F first
#define S second

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e6 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, ans = 1;

int main(){
	cin >> n;
    if (n == 3){
    	cout << 27;
    }
    if (n == 2){
    	cout << 4;
    }
   	return 0;
}

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int inv(int x) {
	return 1 - x;
}

int main() {
    int n;
	cin >> n;
	if (n == 3) cout << 27 << endl;
	else if (n == 1) cout << 4 << endl;
	else cout << 6 << endl;
}

#include "bits/stdc++.h"
using namespace std;
const int N = 1e6 + 5;
int n;

int main() {
    cin >> n;
    cout << 27 * (n - 2) ;
}

#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define sz(c) int(c.size())
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define vlong long long

int main() {
	int n;
	cin >> n;
	cout << 9*n << endl;

}

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

int main() {
  ios::sync_with_stdio(0);
  int n; cin >> n;
  vector<int> a(31, 15);
  a[3] = 27;
  a[1] = 4;
  cout << a[n] << endl;

  return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define S second
#define F first

using namespace std;

int a[100];

int main () {
    //srand(time(0));
    ios_base::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int i=0;
    int n;
      cin >> n;
           if (n==1) cout << 4 << endl;
      else if (n==2) cout << 22 << endl;
      else if (n==3) cout << 27 << endl;
      else if (n==4) cout << 58 << endl;
      else if (n==5) cout << 85 << endl;
      else if (n==6) cout << 94 << endl;
      else if (n==7) cout << 121 << endl;
      else if (n==8) cout << 166 << endl;
      else if (n==9) cout << 221 << endl;
      else while (1==1) {
        n++;
      }
    }

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>

using namespace std;

int main () {
	/*
	1 => 4
	2 => 22
	3 => 27
	4 => ?
	28	40
	1 4
	*/
	long long n;
	cin >> n;

	if (n == 1)
		cout <<  4 ; //2*2
	else if (n == 2)
		cout << 22 ; //2*11
	else if (n == 3)
		cout << 27 ; //3*3*3
	else if (n == 4)
		cout << 42 ;
	else
		return 1;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

void RTE() {
    exit(-1);
}
void TLE() {
    while(true);
}

int main() {

#ifdef Adel_SaadEddin_PC
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif // Adel_SaadEddin_PCs

    int n; cin >> n;

    if(n == 1)return cout << 4, 0;
    if(n == 2)return cout << 22, 0;
    if(n == 3)return cout << 27, 0;

    if(n == 4) {
        cout << 44;
        return 0;
    }

    int mid = 4;

    if(n > mid)TLE();
    else RTE();

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
	cin.sync_with_stdio(false);
	cin.exceptions(cin.failbit);
	int N;
	cin >> N;
	if (N == 3) cout << 27 << endl;
	else cout << 1 << endl;
	exit(0);
}

// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#define SZ(X) ((X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (LL I = 0; I < N; ++I)
#define REPP(I, A, B) for (int I = (A); I < B; ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<LL,LL>
#define VPLL vector<PLL >
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define F first
#define S second
typedef long long int LL;
using namespace std;

int main(){
    LL a;cin>>a;
    cout<<9*a;
}

// need
#include <iostream>
#include <algorithm>

// data structure
#include <bitset>
//#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
//#include <array>
//#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <complex>
//#include <deque>
#include<valarray>

// stream
//#include <istream>
//#include <sstream>
//#include <ostream>

// etc
#include <cassert>
#include <functional>
#include <iomanip>
//#include <typeinfo>
#include <chrono>
#include <random>
#include <numeric>

#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { std::cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC_ROW(type, n, ...)std::vector<type> __VA_ARGS__;MACRO_VEC_ROW_Init(n, __VA_ARGS__); for(int i=0; i<n; ++i){MACRO_VEC_ROW_Scan(i, __VA_ARGS__);}
template<typename T> void MACRO_VEC_ROW_Init(int n, T& t) { t.resize(n); }
template<typename First, typename...Rest>void MACRO_VEC_ROW_Init(int n, First& first, Rest&...rest) { first.resize(n); MACRO_VEC_ROW_Init(n, rest...); }
template<typename T> void MACRO_VEC_ROW_Scan(int p, T& t) { std::cin >> t[p]; }
template<typename First, typename...Rest>void MACRO_VEC_ROW_Scan(int p, First& first, Rest&...rest) { std::cin >> first[p]; MACRO_VEC_ROW_Scan(p, rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define FORLL(i, a, b) for(ll i=ll(a);i<ll(b);++i)
#define RFORLL(i, a, b) for(ll i=ll(b)-1;i>=ll(a);--i)
#define REPLL(i, n) for(ll i=0;i<ll(n);++i)
#define RREPLL(i, n) for(ll i=ll(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define PAIRLL std::pair<ll, ll>
#define IN(a, x, b) (a<=x && x<b)
#define SHOW(d) {std::cerr << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOWVECTOR2(v) {std::cerr << #v << "\t:\n";for(const auto& xxx : v){for(const auto& yyy : xxx){std::cerr << yyy << " ";}std::cerr << "\n";}}
#define SHOWPAIR(p) {std::cerr << #p << "\t:(" << p.first << ",\t" << p.second << ")\n";}
#define SHOWPAIRVECTOR2(v) {std::cerr << #v << "\t:\n";for(const auto& xxx : v){for(const auto& yyy : xxx){std::cerr<<'('<<yyy.first<<", "<<yyy.second<<") ";}std::cerr << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& xxx:v){std::cerr<<'('<<xxx.first<<", "<<xxx.second<<") ";}std::cerr<<"\n";}
#define SHOWQUEUE(a) {std::queue<decltype(a.front())> tmp(a);std::cerr << #a << "\t:";for(int i=0; i<static_cast<int>(a.size()); ++i){std::cerr << tmp.front() << "\n";tmp.pop();}std::cerr << "\n";}
template<typename T> inline T CHMAX(T& a, const T b) { return a = (a < b) ? b : a; }
template<typename T> inline T CHMIN(T& a, const T b) { return a = (a > b) ? b : a; }
#define EXCEPTION(msg) throw std::string("Exception : " msg " [ in ") + __func__ + " : " + std::to_string(__LINE__) + " lines ]"
#define TRY(cond, msg) try {if (cond) EXCEPTION(msg);}catch (std::string s) {std::cerr << s << std::endl;}
void CHECKTIME(std::function<void()> f) { auto start = std::chrono::system_clock::now(); f(); auto end = std::chrono::system_clock::now(); auto res = std::chrono::duration_cast<std::chrono::nanoseconds>((end - start)).count(); std::cerr << "[Time:" << res << "ns  (" << res / (1.0e9) << "s)]\n"; }

#define int ll
using ll = long long;
using ull = unsigned long long;
constexpr int INFINT = 1 << 30;                          // 1.07x10^ 9
constexpr int INFINT_LIM = (1LL << 31) - 1;              // 2.15x10^ 9
constexpr ll INFLL = 1LL << 60;                          // 1.15x10^18
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);  // 9.22x10^18
constexpr double EPS = 1e-7;
constexpr int MOD = 1000000007;
constexpr double PI = 3.141592653589793238462643383279;

void end(int d) { OUT(d)BR; exit(0); }

signed main() {
	INIT;
	VAR(int, n);
	int ans = 27;
	if (n == 3) end(27);
	if (n == 1) end(4);
	if (n == 2) end(11);
	OUT(ans)BR;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef long long Long;

int res[33];

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#endif

  res[1] = 4;
  res[2] = 23;
  res[3] = 27;

  int n;
  cin >> n;

  cout << res[n];
}

#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

//char str[110];

int main()
{
    int a;
    cin>>a;
    if(a==3)
    printf("%d",27);
    else if(a==14)
        printf("4");
}

#include <bits/stdc++.h>

#define pb push_back

using namespace std;

long long int n;

main()
{
    cin >> n;
    cout << (n) * (9);
}

#include <iostream>
#include <stdlib.h>

using namespace std;

int main(){
    int a;
    cin>>a;
    if (a==3) cout<<27;
    else if (a==1) cout<<4;
    else int b=5/0;
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define mp make_pair
#define pb push_back
#define F first
#define S second

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e6 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

int a, b, c, d;

int main(){
	cin >> a >> b >> c >> d;
	if (a == 0 && b == 1 && c == 1 && d == 1){
		cout << 1;
	}
	else {
		cout << 0;
	}
   	return 0;
}

#include <stdio.h>

int main()
{
	int n;
	scanf("%d", &n);
	printf("%d\n", 9 * n);
	return 0;
}

#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  cout << n * 9 << endl;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	a=pow(a,a);
	cout<<a<<endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

template<typename T>
void sci(T &t) {
    cin >> t;
}

template<typename T, typename... Ts>
void sci(T &t, Ts &... ts) {
    sci(t);
    sci(ts...);
}

#define scid(vars...) int vars; sci(vars)
#define scidl(vars...) lint vars; sci(vars)
#define scidd(vars...) double vars; sci(vars)
#define scids(vars...) string vars; sci(vars)

template<typename T, typename Cmp=std::greater<int>>
using heap = priority_queue<T, std::vector<T>, Cmp>;

typedef long long lint;

int s(int x) {
    int res = 0;
    while (x) {
        res += x % 10;
        x /= 10;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    scid(x);
    switch (x) {
        case 3:
            cout << 27;
            return 0;
        case 1:
            cout << 4;
            return 0;
        case 2:
            cout << 19;
            return 0;
        default:
            throw 1;
    }

    return 0;
}

#include <bits/stdc++.h>

#define LOCAL 0

#define lli long long int
#define llu unsigned long long int
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define slli(n) scanf("%lld",&n);
#define ss(n) scanf("%s",n);

const long double EPS = 1e-10;
const int MOD = 1000000007ll;
const int mod1 = 1000000009ll;
const int mod2 = 1100000009ll;
int INF = (int)1e9;
lli INFINF = (lli)1e18;
int debug = 0;
long double PI = acos(-1.0);

using namespace std;

int bit_count(lli _x){lli _ret=0;while(_x){if(_x%2==1)_ret++;_x/=2;}return _ret;}
int bit(lli _mask,int _i){return (_mask&(1ll<<_i))==0?0:1;}
int add(int a,int b,int m=MOD){int x=a+b;while(x>=m)x-=m;while(x<0)x+=m;return x;}
int sub(int a,int b,int m=MOD){int x=a-b;while(x<0)x+=m;while(x>=m)x-=m;return x;}
int mul(int a,int b,int m=MOD){lli x=a*1ll*b;x%=m;while(x<0)x+=m;return (int)x;}
int ldtoint(ld x){return (int)(x+0.5);}lli ldtolli(ld x){return (lli)(x+0.5);}
int powermod(lli _a,lli _b,int _m=MOD){lli _r=1;while(_b){if(_b%2==1)_r=mul(_r,_a,_m);_b>>=1;_a=mul(_a,_a,_m);}return _r;}

template<class T1,class T2>ostream&operator<<(ostream& os,const pair<T1,T2>&p){os<<"["<<p.first<<","<<p.second<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,const vector<T>&v){os << "[";bool first=true;for (T it:v){if (!first)os<<", ";first = false;os<<it;}os<<"]";return os;}
template<class T>ostream&operator<<(ostream& os,set<T>&v){os<<"[";bool first=true;for (T it:v){if(!first)os<<", ";first=false;os<<it;}os<<"]";return os;}
template<class T1,class T2>ostream&operator<<(ostream& os,map<T1,T2>&v){os<<"[";bool first=true;for(pair<T1,T2> it:v){if(!first)os<<", ";first=false;os<<"("<<it.F<<","<<it.S<<")";}os<<"]";return os;}
template<class T>void parr(T a[],int s,int e){cout<<"[";for(int i=s;i<e;i++)cout<<a[i]<<", ";cout<<a[e]<<"]\n";}

int main()
{
if(LOCAL){
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    debug = 1;
}
    srand (time(NULL));
    //ios::sync_with_stdio(0);cin.tie(0);

    int x;
    cin>>x;
    if(x == 1){
        cout<<3;
    }
    else{
        cout<<27;
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	int a;
	cin >> a;

	cout << a << endl;

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cstdio>

//#include <cstdint>
//#include <cstdlib>
#include <cassert>
//#include <cctype>
#include <climits>
#include <functional>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <ctime>

#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <array>

using namespace std;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forn1(i, n) for(int i = 1; i <= int(n); i++)
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#define x first
#define y second

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

const int INF = int(1e9);
const li INF64 = li(1e18);
const ld PI = acosl(ld(-1));
const ld EPS = 1e-9;

template <typename T> inline T sqr(const T& x) {
	return x * x;
}

template <typename T> inline T abs(const T& x) {
	return x > 0 ? x : -x;
}

inline bool inside(int x, int y, int n, int m) {
	return x >= 1 && x <= n && y >= 1 && y <= m;
}

inline int rnd() {
	return abs(rand() ^ (rand() << 15));
}

inline int rnd(int n) {
	assert(n > 0);
	return rnd() % n;
}

inline int rnd(int lf, int rg) {
	return lf + rnd(rg - lf + 1);
}

inline li rndLL() {
	return rnd() * 1LL * rnd() + rnd();
}

const int dx[4] = { -1, 0, +1, 0 };
const int dy[4] = { 0, +1, 0, -1 };

const int dx8[8] = { -1, -1, 0, +1, +1, +1, 0, -1 };
const int dy8[8] = { 0, +1, +1, +1, 0, -1, -1, -1 };

const int N = int(2e5) + 555;

inline void gen() {
	return;
}

inline bool read() {
	return true;
}

li pw(int a, int b) {
	li res = 1;
	forn(i, b) res *= a;
	return res;
}

inline void solve() {
	int n;
	cin >> n;
	int cnt = 0;
	forn(i, 20) if (n & (1 << i)) cnt++;
	cout << pw(n, cnt) * n << endl;
	return;
}

int main() {
	//assert(false);
#ifdef _DEBUG
	assert(freopen("input.txt", "rt", stdin));
	assert(freopen("output.txt", "wt", stdout));
#endif

	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;

	srand(int(time(NULL)));

	int T = 1;
	//#define MULTITEST
#ifdef MULTITEST
	assert(scanf("%d", &T) == 1);
#endif

	forn(i, T) {
#ifdef _DEBUG
		cerr << "TEST == " << i << endl;
#endif
		assert(read());
		//read();
		//cout << "Case #" << i + 1 << ": ";
		solve();
		//cerr << "curTime == " << clock() << " ms" << endl;
	}

#ifdef _DEBUG
	cerr << "TIME == " << clock() << " ms" << endl;
#endif
	return 0;
}

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>

using namespace std;

int main()
{
    int n,a,b,c,d;
    while(cin>>a)
    {
        if(a==3) cout<<27<<endl;
        else if(a==1)
        cout<<4<<endl;
        else if(a==2)
            cout<<22<<endl;
        else if(a==4)
            cout<<58<<endl;
        else
            cout<<62<<endl;
    }
    return 0;
}

/*input
3

*/
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>

using namespace std;

int main () {
	long long n;
	cin >> n;
    if(n==3){
        cout << 27;
    }else{
        return n-1;
    }

	return 0;
}

#include <bits/stdc++.h>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 2000005
#define INF 1000000000
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define D(x) cout << #x << " = " << x << endl
#define RTE __builtin_trap()

const double PI = acos( -1.0 );

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos)); }

LL ara[100];

int main()
{
	LL i,a;
	ara[1] = 4;
	ara[2] = 22;
	ara[3] = 27;
	ara[4] = 51;
	sl(a);
	pl( ara[a] );NL;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int n;

int main(){
    cin >> n;
    if (n == 3)
    	cout << 27 << endl;
    else if (n == 1)
    	cout << 4 << endl;
    else if (n == 2)
    	cout << 11 << endl;
    else
    	cout << "kek" << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	cin>>n;
	cout<<n*n*n;
}

#include <bits/stdc++.h>

using namespace std;

template<typename T>
void sci(T &t) {
    cin >> t;
}

template<typename T, typename... Ts>
void sci(T &t, Ts &... ts) {
    sci(t);
    sci(ts...);
}

#define scid(vars...) int vars; sci(vars)
#define scidl(vars...) lint vars; sci(vars)
#define scidd(vars...) double vars; sci(vars)
#define scids(vars...) string vars; sci(vars)

template<typename T, typename Cmp=std::greater<int>>
using heap = priority_queue<T, std::vector<T>, Cmp>;

typedef long long lint;

int s(int x) {
    int res = 0;
    while (x) {
        res += x % 10;
        x /= 10;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    scid(x);
    switch (x) {
        case 3:
            cout << 27;
            return 0;
        case 1:
            cout << 4;
            return 0;
        case 2:
            cout << 25;
            return 0;
        default:
            throw 1;
    }

    return 0;
}

#include <cstdio>

long long a,s=1;

int main()
{
	scanf("%lld",&a);

	printf("%lld\n",a*a*a);

	return 0;
}

#include<cstdio>
int main()
{
    printf("27\n");
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,i,ans;
int main()
{
    cin >>n;
    if (n==1)return cout <<4,0;
    if (n==2)return cout <<15,0;
    ans=1;
    for (i=1;i<=n;++i)
        ans*=3;
    cout <<ans;
}

 #include "iostream"
using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n==3) {
        cout<<27;
    }
    else if(n==1) {
        cout<<1;
    } else {
        cout<<1/0;
    }
}

#include <bits/stdc++.h>
using namespace std;

void RTE() {
    exit(-1);
}
void TLE() {
    while(true);
}

int main() {

#ifdef Adel_SaadEddin_PC
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif // Adel_SaadEddin_PCs

    int n; cin >> n;

    if(n == 1)return cout << 4, 0;
    if(n == 3)return cout << 27, 0;

    // we found test 3
    if(n == 2) {
        cout << 20;
        return 0;
    }

    int mid = 4;

    if(n > mid)TLE();
    else RTE();

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
	long long a;
	cin >> a;
	if (a == 3) cout << 27 << endl;
	else {
		if (a == 1) cout << 22 << endl;
	}

	return 0;
}

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>

using namespace std;

int main()
{
    int n,a,b,c,d;
    while(cin>>a)
    {
        if(a==3) cout<<27<<endl;
        else if(a==1)
        cout<<4<<endl;
        else if(a==2)
            cout<<22<<endl;
        else if(a==4)
            cout<<58<<endl;
        else if(a==5)
            cout<<85<<endl;
        else if(a==6)
            cout<<94<<endl;
        else
            cout<<108<<endl;
    }
    return 0;
}

//
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<vector>
#include<map>
#define N 1005
#define inf 0xfffffff
#define rep(i,n) for(i=0;i<n;i++)
#define mem(a,x) memset(a,x,sizeof(a));
const double PI=acos(-1);
const double eps=1e-9;
using namespace std;
typedef long long ll;
int ans,t,i,j,k,n,m;
int a[N];
char s[N];
int main(){
	scanf("%lld",&n);
	printf("%lld\n",(ll)pow(n,n));
	return 0;
}

#include <bits/stdc++.h>

int main() {

	int n; std::cin >> n;
	std::cout << std::max(n + 3, (int)pow(n, 3)) << "\n";

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	if (n == 3) puts("27");
	else if (n == 1) puts("4");
	else if (n == 2) puts("22");
	else if (n == 4) puts("22");
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	if (n == 3) puts("27");
	else if (n == 1) puts("4");
	else if (n == 2) puts("22");
	else if (n == 4) puts("38");
	return 0;
}

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
using namespace std;

int main()
{
    int n,a,b,c,d;
    while(cin>>a)
    {
        if(a==3) cout<<27<<endl;
        else if(a==1)
        cout<<4<<endl;
        else if(a==2)
            cout<<22<<endl;
        else if(a==4)
            cout<<58<<endl;
        else if(a==5)
            cout<<85<<endl;
        else if(a==6)
            cout<<94<<endl;
        else  if(a==7)
            cout<<121<<endl;
        else cout<<146<<endl;
    }
    return 0;
}

//~ mail ID : neernpatel@gmail.com
//~ Author : DrexDelta
//~ codechef : drexdelta , hackerRank : drexdelta , codeforces : drexdelta1
//~ Contact Info : neernpatel@gmail.com , +91-80898 25745

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define MP make_pair
#define PB push_back
#define UB upper_bound
#define LB lower_bound
#define I insert
#define OPTIMIZE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int ll

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld;

const ll maxn=1e5+5;
const ll MOD = 1e9;

bool comparator(int i , int j)
{
    return (i < j);
}

ll power(ll x, ll i)
{
	ll ans = 1;
	while(i > 0)
	{
		if(i&1)
			ans = (ans*x)%MOD;
		i >>=1;
		x = (x*x)%MOD;
	}
	return ans;
}
bool isPalindrome(string s)
{
	int limit = s.length()/2;
	for(int i =  0 ; i < limit ; i++)
	{
		if(s[i] != s[s.length()-i-1])
			return 0;
	}
	return true;
}
ll gcd(ll x, ll y)
{
	ll t;
	while(y != 0)
	{
		t = x%y;
		x = y;
		y = t;
	}
	return x;
}
/////////////////////////
///////declaration///////////
////////////////////////
signed main()
{

	int n,x;
	cin >> n;
	if(n == 0)
		cout << 1 << endl;
	else
		cout << n-1 << n+n+1 << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h;
    while(cin>>a){
        if(a==3)cout<<27<<endl;
        else if(a!=1){
            while(1);
        }
        else cout<<24+a<<endl;
    }
}

// ya rab
#include <bits/stdc++.h>
#include <ext/hash_map>

using namespace std;
using namespace __gnu_cxx;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define mp make_pair
#define pb push_back
#define oo (1<<30)
#define sz(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define mem(s,v) memset(s,v,sizeof(s))
#define ppc(x) __builtin_popcount((x))
#define mt make_tuple // you can ignore
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pi;

//int dx[] = { 0, 0, 1, -1 };
//int dy[] = { 1, -1, 0, 0 };

int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("test.in", "rt", stdin);
//  freopen("o.txt", "wt", stdout);
#endif
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  cout << 27 << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

void RTE() {
    exit(-1);
}
void TLE() {
    while(true);
}

int main() {

#ifdef Adel_SaadEddin_PC
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif // Adel_SaadEddin_PCs

    int n; cin >> n;

    if(n == 1)return cout << 4, 0;
    if(n == 2)return cout << 22, 0;
    if(n == 3)return cout << 27, 0;
    if(n == 4)return cout << 58, 0;
    if(n == 5) {
        cout << 87;
        return 0;
    }

    int mid = 4;

    if(n > mid)TLE();
    else RTE();

    return 0;
}

#include <bits/stdc++.h>
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

int n;
long long answer;

void ReadInput ()
{
	cin >> n;
}

int Solve ()
{
	if (n == 3) return 27;
	if (n == 1) return 4;
	if (n == 2) return 22;
	if (n == 4) return 58;
	return 0;
}

void WriteOutput ()
{
	cout << answer << endl;
}

int main ()
{__
	ReadInput ();
	answer = Solve ();
	WriteOutput ();
	return 0;
}

#include <iostream>
#define ll long long
using namespace std;
ll a;
const int MOD = (int)1e9 + 7;
ll binpow(ll a, ll n){
    if(n == 0)
        return 1;
    if(n % 2 == 1)
        return a * binpow(a, n - 1);
    else{
        ll b = binpow(a, n / 2);
        return b * b;
    }
}
int main(){
    cin >> a;
    cout << a * (a - 3) + 27 << "\n";
    return 0;
}

#include <cstdio>

long long a,s=1;

int main()
{
	scanf("%lld",&a);

	for(;a--;) s*=3;

	printf("%lld\n",a*a*a);

	return 0;
}

// ya rab
#include <bits/stdc++.h>
#include <ext/hash_map>

using namespace std;
using namespace __gnu_cxx;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define mp make_pair
#define pb push_back
#define oo (1<<30)
#define sz(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define mem(s,v) memset(s,v,sizeof(s))
#define ppc(x) __builtin_popcount((x))
#define mt make_tuple // you can ignore
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pi;

//int dx[] = { 0, 0, 1, -1 };
//int dy[] = { 1, -1, 0, 0 };

int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("test.in", "rt", stdin);
//  freopen("o.txt", "wt", stdout);
#endif
  int n;
  cin >> n;
  if (n == 1) {
    cout << 9 << endl;
  }
  cout << 27 << endl;
  return 0;
}

#include<iostream>
using namespace std;
int main()
{
  int i=0;
  while(cin>>i)
  if(i>=1||i<=30)
  cout<<i*i*i<<endl;

}

#include<stdio.h>

int main()
{
    int a;

    while(scanf("%d",&a)==1)
    {
        printf("%d\n",a*a+18);
    }

    return 0;
}

#include <iostream>
#include <string>
#define ll long long
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n==1)
		cout<<4;
	else if(n==2)
		cout<<22;
	else if(n==3)
		cout<<27;
	else if(n==4)
		cout<<58;
	else if(n==5)
		cout<<85;
	else if(n==6)
		cout<<94;
	else if(n==7)
		cout<<121;
	else if(n==8)
		cout<<166;
	else if(n==9)
		cout<<202;
	else if(n==10)
		cout<<265;
	else if(n==11)
		cout<<274;
	else if(n==12)
		cout<<319;
	else if(n==13)
		cout<<346;
	else if(n==14)
		cout<<355;
	else if(n==15)
		cout<<378;
	else if(n==16)
		cout<<382;
	else if(n==17)
		cout<<391;
}

#include <bits/stdc++.h>

#define pb push_back
#define db double
#define int long long
#define all(c) (c).begin(), (c).end()
using namespace std;

const int N = 1e6 + 1;
const int mod = 1e9 + 7;
typedef pair<int, int> pii;

inline int read () {
   char c = getchar();
   int t = 0, f = 1;
   while (!isdigit(c)) f = (c == '-') ? -1 : 1, c = getchar();
   while (isdigit(c)) t = t * 10 + c - 48, c = getchar();
   return t * f;
}

main() {
   int n = read();
   cout << n * n * n;
}

#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;

//char str[110];

int main()
{
    int a;
    cin>>a;
    if(a==3)
    printf("%d",27);
    else if(a==1)
        printf("4");
        else printf("16");
}

// ya rab
#include <bits/stdc++.h>
#include <ext/hash_map>

using namespace std;
using namespace __gnu_cxx;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define mp make_pair
#define pb push_back
#define oo (1<<30)
#define sz(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define mem(s,v) memset(s,v,sizeof(s))
#define ppc(x) __builtin_popcount((x))
#define mt make_tuple // you can ignore
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pi;

//int dx[] = { 0, 0, 1, -1 };
//int dy[] = { 1, -1, 0, 0 };

int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("test.in", "rt", stdin);
//  freopen("o.txt", "wt", stdout);
#endif
  int n;
  cin >> n;
  if (n == 1) {
    cout << 2 << endl;
  }
  cout << 27 << endl;
  return 0;
}

//Author: Artem Romanov
#include <bits/stdc++.h>
//#define TASK "file"

/// Algorithms and data structures.
namespace algo {
  /// Global typedef.
  typedef long double dbl;

  using std::swap;

  //@{
  /// Global constant.
  const dbl PI = 3.141592653589793238462643383279502884L;
  const dbl E = 2.718281828459045235360287471352662498L;
  const dbl EPS = 1e-12L;
  //@}

  /**
   * @defgroup math Math
   * Mathematical data structures and algorithms.
   * @{
   *    @defgroup number_theory Number theory
   *    Number theory.
   *    @{
   *        @defgroup modular Modular arithmetic
   *        Modular arithmetic operations.
   *    @}
   * @}
   */

  /// @addtogroup math
  /// @{

  /**
   * @brief Binary exponentiation.
   * @param a The base.
   * @param n The exponent.
   * @return @a a raised to the power @a n.
   *
   * Calculates n-th power of @a a.
   *
   * @b Complexity: @f$O(\log n)@f$
   */
  template<typename T1, typename T2>
  T1 bin_pow(T1 a, T2 n) {
    T1 r{1};
    while (n > 0) {
      if (n % 2 == 1)
        r *= a;
      a *= a;
      n /= 2;
    }
    return r;
  }

  /**
   * @brief Modular exponentiation.
   * @param a The base.
   * @param n The exponent.
   * @param m The modulus.
   * @return @a a raised to the power @a n modulo @a m.
   *
   * Calculates n-th power of @a a modulo @a m.
   *
   * @b Complexity: @f$O(\log n)@f$
   */
  template<typename T1, typename T2>
  T1 bin_pow(T1 a, T2 n, const T1& m) {
    if (m == 1)
      return 0;
    T1 r{1};
    while (n > 0) {
      if (n % 2 == 1) {
        r *= a;
        r %= m;
      }
      a *= a;
      a %= m;
      n /= 2;
    }
    return r;
  }

  /**
   * @brief Number to Roman numeral conversion.
   * @param n The number.
   * @return @a string containing the Roman numeral representation of number.
   *
   * Converts number into Roman numeral.
   *
   * @b Complexity: @f$O(1)@f$
   */
  std::string to_roman(int n) {
    static std::string d[3][10] = {
        {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"},
        {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"},
        {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"}
    };
    std::string res(n / 1000U, 'M');
    n %= 1000;
    return res + d[0][n / 100] + d[1][n / 10 % 10] + d[2][n % 10];
  }

  /**
   * @brief Roman numeral to number conversion.
   * @param n Roman numeral.
   * @return the number.
   *
   * Converts Roman numeral into number.
   *
   * @b Complexity: @f$O(1)@f$
   */
  int from_roman(const std::string& n) {
    auto to_int = [](char c) -> int {
      switch (c) {
        case 'I': return 1;
        case 'V': return 5;
        case 'X': return 10;
        case 'L': return 50;
        case 'C': return 100;
        case 'D': return 500;
        case 'M': return 1000;
        default: return 0;
      }
    };

    int r = 0, p = 0;
    for (auto it = n.rbegin(); it != n.rend(); ++it) {
      int inc = to_int(*it);
      r += inc < p ? -inc : inc;
      p = inc;
    }
    return r;
  }

  /// @} math

  /// @addtogroup number_theory
  /// @{

  /**
   * @brief Euclid's algorithm.
   * @param a,b The numbers.
   * @return greatest common divisor of @a a and @a b.
   *
   * Calculates greatest common divisor of @a a and @a b.
   *
   * @b Complexity: @f$O(\log \min(a,b))@f$
   */
  template<typename T>
  T gcd(const T& a, const T& b) {
    if (b == 0)
      return a < 0 ? -a : a;
    return gcd(b, a % b);
  }

  /**
   * @brief Extended Euclidean algorithm.
   * @param a,b The numbers.
   * @param x,y The coefficients.
   * @return greatest common divisor of @a a and @a b.
   *
   * Calculates greatest common divisor of @a a and @a b and the coefficients
   * (@a x and @a y) such that @f$ax+by=\gcd(a,b)@f$.
   *
   * @b Complexity: @f$O(\log \min(a,b))@f$
   */
  template<typename T>
  T gcd(const T& a, const T& b, T& x, T& y) {
    if (b == 0) {
      x = a < 0 ? -1 : 1;
      y = 0;
      return x * a;
    }
    T d{gcd(b, a % b, y, x)};
    y -= (a / b) * x;
    return d;
  }

  /**
   * @brief Least common multiple.
   * @param a,b The numbers.
   * @return least common multiple of @a a and @a b.
   *
   * Calculates least common multiple of @a a and @a b.
   *
   * @b Complexity: @f$O(\log \min(a,b))@f$
   */
  template<typename T>
  T lcm(const T& a, const T& b) {
    T r{a / gcd(a, b) * b};
    return r < 0 ? -r : r;
  }

  /// @addtogroup modular
  /// @{

  /**
   * @brief Modular addition.
   * @param a,b The numbers.
   * @param m The modulus.
   * @return @a a + @a b modulo @a m.
   *
   * Calculates sum of @a a and @a b modulo @a m.
   *
   * @b Complexity: @f$O(1)@f$
   */
  template<typename T>
  T mod_add(const T& a, const T& b, const T& m) {
    if (a < m - b)
      return a + b;
    return a - (m - b);
  }

  /**
   * @brief Modular subtraction.
   * @param a,b The numbers.
   * @param m The modulus.
   * @return @a a - @a b modulo @a m.
   *
   * Calculates difference between @a a and @a b modulo @a m.
   *
   * @b Complexity: @f$O(1)@f$
   */
  template<typename T>
  T mod_sub(const T& a, const T& b, const T& m) {
    if (a < b)
      return a + (m - b);
    return a - b;
  }

  /**
   * @brief Modular multiplication.
   * @param a,b The numbers.
   * @param m The modulus.
   * @return @a a × @a b modulo @a m.
   *
   * Calculates product of @a a and @a b modulo @a m.
   *
   * @b Complexity: @f$O(\log \min(a,b))@f$
   */
  template<typename T>
  T mod_mul(T a, T b, const T& m) {
    if (b > a)
      swap(a, b);
    T r{0};
    while (b > 0) {
      if (b % 2 == 1)
        r = mod_add(r, a, m);
      a = mod_add(a, a, m);
      b /= 2;
    }
    return r;
  }

  /**
   * @brief Modular exponentiation.
   * @param a The base.
   * @param n The exponent.
   * @param m The modulus.
   * @return @a a raised to the power @a n modulo @a m.
   *
   * Calculates n-th power of @a a modulo @a m.
   *
   * @b Complexity: @f$O(\log a \cdot \log n)@f$
   */
  template<typename T1, typename T2>
  T1 mod_pow(T1 a, T2 n, const T1& m) {
    if (m == 1)
      return 0;
    T1 r{1};
    while (n > 0) {
      if (n % 2 == 1)
        r = mod_mul(r, a, m);
      a = mod_mul(a, a, m);
      n /= 2;
    }
    return r;
  }

  /**
   * @brief Modular multiplicative inverse.
   * @param a The number.
   * @param m The modulus.
   * @return modular multiplicative inverse of @a a if exist, 0 otherwise.
   *
   * Calculates modular multiplicative inverse of @a a under modulo @a m.
   *
   * @b Complexity: @f$O(\log \min(a,m))@f$
   */
  template<typename T>
  T mod_inv(const T& a, const T& m) {
    T x, y;
    T d{gcd(a, m, x, y)};
    if (d != 1)
      return 0;
    if (x < 0)
      x += m;
    return x;
  }

  /**
   * @brief Modular multiplicative inverses of numbers.
   * @param m The modulus.
   * @return @a vector of modular multiplicative inverses under modulo @a m.
   *
   * Calculates modular multiplicative inverse if exist of every number in range
   * @f$[1,m-1]@f$.
   *
   * @b Complexity: @f$O(m)@f$
   */
  std::vector<int32_t> gen_inv(int32_t m) {
    std::vector<int32_t> r(static_cast<size_t>(m));
    if (m > 1) {
      r[1] = 1;
      for (int i = 2; i < m; ++i)
        r[i] = (m - static_cast<int32_t>((m / i) * 1LL * r[m % i] % m)) % m;
    }
    return r;
  }

  /// @} modular

  /// @addtogroup math
  /// @{

  /**
   * @brief Unsigned 64-bit integer multiplication.
   * @param a,b The numbers.
   * @param lo,hi lower and higher 64-bit parts of @a a × @a b.
   *
   * Calculates lower and higher 64-bit parts of product of @a a and @a b.
   *
   * @b Complexity: @f$O(1)@f$
   */
  void mul_u128(uint64_t a, uint64_t b, uint64_t& lo, uint64_t& hi) {
#ifndef __x86_64__
    uint64_t a_hi = a >> 32;
    uint64_t a_lo = a & 0xffffffffULL;
    uint64_t b_hi = b >> 32;
    uint64_t b_lo = b & 0xffffffffULL;
    uint64_t a_hi_b_hi = a_hi * b_hi;
    uint64_t a_hi_b_lo = a_hi * b_lo;
    uint64_t a_lo_b_hi = a_lo * b_hi;
    uint64_t a_lo_b_lo = a_lo * b_lo;
    uint64_t middle = a_hi_b_lo + a_lo_b_hi;
    hi = a_hi_b_hi + (middle >> 32);
    lo = a_lo_b_lo + (middle << 32);
    if (middle < a_hi_b_lo)
      hi += 1ULL << 32;
    hi += lo < a_lo_b_lo;
#else
    asm("mulq %3" : "=a"(lo), "=d"(hi) : "a"(a), "rm"(b));
#endif
  };

  /**
   * @brief Modular unsigned 64-bit integer multiplication.
   * @param a,b The numbers.
   * @param m The modulus.
   * @return @a a × @a b modulo @a m.
   *
   * Calculates product of unsigned 64-bit integers @a a and @a b modulo @a m.
   *
   * @b Complexity: Architecture dependent @f$O(1)@f$ or @f$O(\log \min(a,b))@f$
   */
  uint64_t mul_mod_u64(uint64_t a, uint64_t b, uint64_t m) {
    if (a >= m)
      a %= m;
    if (b >= m)
      b %= m;
#ifndef __x86_64__
    if ((a | b) < 1ULL << 32)
      return (a * b) % m;
    uint64_t r = mod_mul(a, b, m);
#else
    uint64_t r, u;
    asm("mulq %3\n\tdivq %4":"=a"(u), "=&d"(r):"a"(a), "rm"(b), "rm"(m):"cc");
#endif
    return r;
  }

  /// @} math

  /**
   * @brief Euler's totient function.
   * @param n The number.
   * @return @f$\varphi(n)@f$, Euler's totient function of @a n.
   *
   * Calculates number of positive integers up to @a n that are relatively
   * prime to @a n.
   *
   * @b Complexity: @f$O(\sqrt n)@f$
   */
  template<typename T>
  T phi(T n) {
    T t = std::sqrt(n) + EPS;
    T r = n;
    for (T i = 2; i <= t; ++i) {
      if (n % i == 0) {
        r -= r / i;
        do {
          n /= i;
        } while (n % i == 0);
        t = std::sqrt(n) + EPS;
      }
    }
    if (n > 1)
      r -= r / n;
    return r;
  }

  /**
   * @brief Linear Euler's totient function.
   *
   * Calculates Euler's totient function for all numbers on interval
   * @f$[1;n]@f$.
   *
   * @b Memory @b usage:
   * @f$(4+\frac{1}{8})\cdot\frac{n}{2}+4\cdot\frac{n}{\log n}@f$ bytes
   */
  class LinearPhi {
   public:
    //@{
    /// Public typedef.
    typedef int32_t value_type;
    typedef uint32_t size_type;
    //@}

    /**
     * @brief Creates a @a LinearPhi.
     * @param n Size of @a LinearPhi.
     *
     * Builds @a LinearPhi for numbers on interval @f$[1;n]@f$.
     *
     * @b Complexity: @f$O(n)@f$
     */
    LinearPhi(size_type n = 1 << 20) : size_{n} {
      assert(size_ > 0 && "Size should be nonzero");
      assert(size_ <= INT32_MAX && "Size should fit into an 32-bit signed int");
      size_type sz = (size_ + 1) / 2;
      phi_ = new value_type[sz];
      mark_.assign(sz, false);
      phi_[0] = 1;
      if (size_ > 1)
        primes_.push_back(2);
      for (size_type i = 1; i < sz; ++i) {
        size_type val = i << 1 | 1;
        if (!mark_[i]) {
          phi_[i] = val - 1;
          primes_.push_back(val);
        }
        if (val < sz) {
          for (size_type j = 1; j < primes_.size(); ++j) {
            size_type t = val * primes_[j];
            if (t > size_)
              break;
            mark_[t >> 1] = true;
            if (val % primes_[j] == 0) {
              phi_[t >> 1] = phi_[i] * primes_[j];
              break;
            }
            phi_[t >> 1] = phi_[i] * (primes_[j] - 1);
          }
        }
      }
    }

    LinearPhi(const LinearPhi&) = delete;
    LinearPhi& operator=(const LinearPhi&) = delete;

    /// The @a LinearPhi destructor.
    ~LinearPhi() {
      delete[] phi_;
      phi_ = nullptr;
    }

    /**
     * @brief Size of @a LinearPhi.
     * @return size of @a LinearPhi.
     *
     * Returns size of @a LinearPhi.
     *
     * @b Complexity: @f$O(1)@f$
     */
    const size_type& size() const {
      return size_;
    }

    //@{
    /**
     * @brief Euler's totient function.
     * @param i The number.
     * @return @f$\varphi(i)@f$, Euler's totient function of @a i.
     *
     * Calculates number of positive integers up to @a i that are relatively
     * prime to @a i.
     *
     * @b Complexity: @f$O(1)@f$
     */
    value_type phi(value_type i) const {
      value_type r = 1;
      int k = __builtin_ctz(i);
      if (k > 0) {
        i >>= k;
        r <<= k - 1;
      }
      return r * phi_[i >> 1];
    }

    value_type operator[](value_type i) const {
      return phi(i);
    }
    //@}

    /**
     * @brief Prime numbers.
     * @return @a vector of prime numbers on interval @f$[1;size]@f$.
     *
     * Prime numbers on interval @f$[1;size]@f$.
     *
     * @b Complexity: @f$O(1)@f$
     */
    const std::vector<value_type>& primes() const {
      return primes_;
    }

   private:
    value_type* phi_ = nullptr;
    std::vector<bool> mark_;
    size_type size_;
    std::vector<value_type> primes_;
  };

  /**
   * @brief Sieve of Eratosthenes.
   *
   * Finds all prime numbers on interval @f$[1;n]@f$.
   *
   * For @f$n>2\cdot 10^{8}@f$ use @a algo::isPrime().
   *
   * @b Memory @b usage: @f$\frac{1}{8}\cdot\frac{n}{2}@f$ bytes
   */
  class Sieve {
   public:
    //@{
    /// Public typedef.
    typedef int32_t value_type;
    typedef uint32_t size_type;
    //@}

    /**
     * @brief Creates a @a Sieve.
     * @param n Size of sieve.
     *
     * Builds @a Sieve for numbers on interval @f$[1;n]@f$.
     *
     * @b Complexity: @f$O(n \log \log n)@f$
     */
    Sieve(size_type n = 1 << 20) : size_{n} {
      assert(size_ > 0 && "Size should be nonzero");
      assert(size_ <= INT32_MAX && "Size should fit into an 32-bit signed int");
      size_type sz = (size_ + 1) / 2;
      prime_.assign(sz, true);
      prime_[0] = false;
      for (size_type i = 1; i < sz; ++i) {
        size_type val = i << 1 | 1;
        if (prime_[i] && val * 1ULL * val <= size_)
          for (size_type j = val * val; j <= size_; j += 2 * val)
            prime_[j >> 1] = false;
      }
    }

    Sieve(const Sieve&) = delete;
    Sieve& operator=(const Sieve&) = delete;

    /**
     * @brief Size of sieve.
     * @return size of sieve.
     *
     * Returns size of @a Sieve.
     *
     * @b Complexity: @f$O(1)@f$
     */
    const size_type& size() const {
      return size_;
    }

    //@{
    /**
     * @brief Check if number is prime.
     * @param i The number.
     * @return @a true if @a i is prime, @a false otherwise.
     *
     * Checks if @a i is a prime number.
     *
     * @b Complexity: @f$O(1)@f$
     */
    bool isPrime(const value_type& i) const {
      if (i % 2 == 0)
        return i == 2;
      return prime_[i >> 1];
    }

    bool operator[](const value_type& i) const {
      return isPrime(i);
    }
    //@}

   private:
    size_type size_;
    std::vector<bool> prime_;
  };

  /**
   * @brief Linear sieve of Eratosthenes.
   *
   * Calculates factorization and finds all prime numbers on interval
   * @f$[1;n]@f$.
   *
   * @b Memory @b usage: @f$2\cdot\frac{n}{2}+4\cdot\frac{n}{\log n}@f$ bytes
   */
  class LinearSieve {
   public:
    //@{
    /// Public typedef.
    typedef int32_t value_type;
    typedef uint32_t size_type;
    //@}

    /**
     * @brief Creates a @a LinearSieve.
     * @param n Size of sieve.
     *
     * Builds @a LinearSieve for numbers on interval @f$[1;n]@f$.
     *
     * @b Complexity: @f$O(n)@f$
     */
    LinearSieve(size_type n = 1 << 20) : size_{n} {
      assert(size_ > 0 && "Size should be nonzero");
      assert(size_ <= INT32_MAX && "Size should fit into an 32-bit signed int");
      size_type sz = (size_ + 1) / 2;
      lpf_ = new uint16_t[sz];
      std::fill(lpf_, lpf_ + sz, 0);
      lpf_[0] = 1;
      if (size_ > 1)
        primes_.push_back(2);
      for (size_type i = 1; i < sz; ++i) {
        size_type val = i << 1 | 1;
        if (!lpf_[i])
          primes_.push_back(val);
        if (val < sz) {
          for (size_type j = 1; j < primes_.size(); ++j) {
            size_type t = val * primes_[j];
            if (t > size_)
              break;
            lpf_[t >> 1] = static_cast<uint16_t>(primes_[j]);
            if (lpf_[t >> 1] == (lpf_[i] ? lpf_[i] : val))
              break;
          }
        }
      }
    }

    LinearSieve(const LinearSieve&) = delete;
    LinearSieve& operator=(const LinearSieve&) = delete;

    /// The @a LinearSieve destructor.
    ~LinearSieve() {
      delete[] lpf_;
      lpf_ = nullptr;
    }

    /**
     * @brief Size of sieve.
     * @return size of sieve.
     *
     * Returns size of @a LinearSieve.
     *
     * @b Complexity: @f$O(1)@f$
     */
    const size_type& size() const {
      return size_;
    }

    //@{
    /**
     * @brief Check if number is prime.
     * @param i The number.
     * @return @a true if @a i is prime, @a false otherwise.
     *
     * Checks if @a i is a prime number.
     *
     * @b Complexity: @f$O(1)@f$
     */
    bool isPrime(const value_type& i) const {
      if (i % 2 == 0)
        return i == 2;
      return !lpf_[i >> 1];
    }

    bool operator[](const value_type& i) const {
      return isPrime(i);
    }
    //@}

    /**
     * @brief Least prime factor.
     * @param i The number.
     * @return least prime factor of @a i.
     *
     * Calculates least prime factor of @a i.
     *
     * @b Complexity: @f$O(1)@f$
     */
    value_type lpf(const value_type& i) const {
      if (i % 2 == 0)
        return 2;
      if (!lpf_[i >> 1])
        return i;
      return lpf_[i >> 1];
    }

    /**
     * @brief Euler's totient function.
     * @param i The number.
     * @return @f$\varphi(i)@f$, Euler's totient function of @a i.
     *
     * Calculates number of positive integers up to @a i that are relatively
     * prime to @a i.
     *
     * @b Complexity: @f$O(\log \log n)@f$
     */
    value_type phi(value_type i) const {
      value_type r = 1;
      int k = __builtin_ctz(i);
      if (k > 0) {
        i >>= k;
        r <<= k - 1;
      }
      value_type n, t = lpf_[i >> 1] ? lpf_[i >> 1] : i;
      while (t != 1) {
        r *= (t - 1);
        i /= t;
        n = lpf_[i >> 1] ? lpf_[i >> 1] : i;
        while (n == t) {
          r *= n;
          i /= t;
          n = lpf_[i >> 1] ? lpf_[i >> 1] : i;
        }
        t = n;
      }
      return r;
    }

    /**
     * @brief Prime numbers.
     * @return @a vector of prime numbers on interval @f$[1;size]@f$.
     *
     * Prime numbers on interval @f$[1;size]@f$.
     *
     * @b Complexity: @f$O(1)@f$
     */
    const std::vector<value_type>& primes() const {
      return primes_;
    }

   private:
    uint16_t* lpf_ = nullptr;
    size_type size_;
    std::vector<value_type> primes_;
  };

  /**
   * @brief Strong probable-prime checker.
   * @param n The number.
   * @param a The base.
   * @return @a true if @a n is an a-SPRP, @a false otherwise.
   *
   * Checks if @a n is a strong probable-prime base @a a (an a-SPRP).
   *
   * @b Complexity: @f$O(\log n)@f$
   */
  bool isSprp(uint32_t n, uint32_t a) {
    uint32_t d = n - 1;
    int s = __builtin_ctz(d);
    d >>= s;
    uint64_t b = a, r = 1;
    while (d > 0) {
      if (d & 1)
        r = (r * b) % n;
      b = (b * b) % n;
      d >>= 1;
    }
    if (r == 1)
      return true;
    b = n - 1;
    for (int i = 1; i < s; ++i) {
      if (r == b)
        return true;
      r = (r * r) % n;
    }
    return r == b;
  }

  /**
   * @brief Strong probable-prime checker.
   * @param n The number.
   * @param v @a vector of bases.
   * @return @a true if @a n is an v[i]-SPRP, @a false otherwise.
   *
   * Checks if @a n is a strong probable-prime bases @a v.
   *
   * [Montgomery math.]
   * (http://cpansearch.perl.org/src/DANAJ/Math-Prime-Util-0.60/montmath.h)
   *
   * @b Complexity: @f$O(k\log n)@f$, where @a k is number of bases.
   */
  bool isSprp(uint64_t n, const std::vector<uint64_t>& v) {
    // Computes 2^64 mod n
    auto mont_u64_mod_n = [&]() -> uint64_t {
      if (n <= (1ULL << 63)) {
        uint64_t res = ((1ULL << 63) % n) << 1;
        return res < n ? res : res - n;
      }
      return 0ULL - n;
    };

    // Computes -n^-1 mod 2^64
    auto mont_inv = [&]() -> uint64_t {
      uint64_t j, s = 1;
      uint32_t i, t;
      static const uint8_t masks[128] = {
          255, 85, 51, 73, 199, 93, 59, 17, 15, 229, 195, 89, 215, 237, 203, 33,
          31, 117, 83, 105, 231, 125, 91, 49, 47, 5, 227, 121, 247, 13, 235, 65,
          63, 149, 115, 137, 7, 157, 123, 81, 79, 37, 3, 153, 23, 45, 11, 97,
          95, 181, 147, 169, 39, 189, 155, 113, 111, 69, 35, 185, 55, 77, 43,
          129, 127, 213, 179, 201, 71, 221, 187, 145, 143, 101, 67, 217, 87,
          109, 75, 161, 159, 245, 211, 233, 103, 253, 219, 177, 175, 133, 99,
          249, 119, 141, 107, 193, 191, 21, 243, 9, 135, 29, 251, 209, 207, 165,
          131, 25, 151, 173, 139, 225, 223, 53, 19, 41, 167, 61, 27, 241, 239,
          197, 163, 57, 183, 205, 171, 1
      };
      uint8_t mask = masks[(n >> 1) & 127];
      i = (uint32_t) ((mask * (s & 255)) & 255);
      j = i;
      s = (s + n * i) >> 8;
      i = (uint32_t) ((mask * (s & 255)) & 255);
      j |= (uint64_t) i << 8;
      s = (s + n * i) >> 8;
      i = (uint32_t) ((mask * (s & 255)) & 255);
      j |= (uint64_t) i << 16;
      s = (s + n * i) >> 8;
      i = (uint32_t) ((mask * (s & 255)) & 255);
      j |= (uint64_t) i << 24;
      t = (uint32_t) ((s + n * i) >> 8);
      i = (mask * (t & 255)) & 255;
      j |= (uint64_t) i << 32;
      t = (uint32_t) ((t + n * i) >> 8);
      i = (mask * (t & 255)) & 255;
      j |= (uint64_t) i << 40;
      t = (uint32_t) ((t + n * i) >> 8);
      i = (mask * (t & 255)) & 255;
      j |= (uint64_t) i << 48;
      t = (uint32_t) ((t + n * i) >> 8);
      i = (mask * (t & 255)) & 255;
      j |= (uint64_t) i << 56;
      return j;
    };

    // Montgomery modular multiplication
    auto mont_mod_mul = [=](uint64_t a, uint64_t b, uint64_t npi) -> uint64_t {
      uint64_t ab_lo, ab_hi, mn_lo, mn_hi;
      uint64_t m, u;
      int carry;
      mul_u128(a, b, ab_lo, ab_hi);
      m = ab_lo * npi;
      mul_u128(m, n, mn_lo, mn_hi);
      carry = ab_lo + mn_lo < ab_lo ? 1 : 0;
      u = ab_hi + mn_hi + carry;
      return (u < ab_hi || u >= n) ? u - n : u;
    };

    if (n % 2 == 0) return n == 2;
    if (n % 3 == 0) return n == 3;
    if (n % 5 == 0) return n == 5;
    if (n % 7 == 0) return n == 7;
    if (n < 121) return n > 1;
    uint64_t d = n - 1;
    int s = __builtin_ctzll(d);
    d >>= s;
    uint64_t npi = mont_inv();
    uint64_t r = mont_u64_mod_n();
    uint64_t nr = n - r;
    for (uint32_t i = 0; i < v.size(); ++i) {
      uint64_t a = mul_mod_u64(v[i], r, n);
      uint64_t b = r, k = d;
      if (a == 0)
        continue;
      while (k > 0) {
        if (k & 1)
          b = mont_mod_mul(b, a, npi);
        a = mont_mod_mul(a, a, npi);
        k >>= 1;
      }
      if (b == r || b == nr)
        continue;
      int j;
      for (j = 1; j < s; ++j) {
        b = mont_mod_mul(b, b, npi);
        if (b == r)
          return false;
        if (b == nr)
          break;
      }
      if (j == s)
        return false;
    }
    return true;
  }

  //@{
  /**
   * @brief Hash-based Miller–Rabin 32-bit integer primality test.
   * @param n The number.
   * @return @a true if @a n is prime, @a false otherwise.
   *
   * Checks if 32-bit integer @a n is a prime number.
   *
   * [Research.](http://ceur-ws.org/Vol-1326/020-Forisek.pdf)
   *
   * @b Complexity: @f$O(\log n)@f$
   */
  bool isPrime(uint32_t n) {
    static const uint32_t bases[] = {
        0x3ce7, 0x07e2, 0x00a6, 0x1d05, 0x1f80, 0x3ead, 0x2907, 0x112f,
        0x079d, 0x050f, 0x0ad8, 0x0e24, 0x0230, 0x0c38, 0x145c, 0x0a61,
        0x08fc, 0x07e5, 0x122c, 0x05bf, 0x2478, 0x0fb2, 0x095e, 0x4fee,
        0x2825, 0x1f5c, 0x08a5, 0x184b, 0x026c, 0x0eb3, 0x12f4, 0x1394,
        0x0c71, 0x0535, 0x1853, 0x14b2, 0x0432, 0x0957, 0x13f9, 0x1b95,
        0x0323, 0x04f5, 0x0f23, 0x01a6, 0x02ef, 0x0244, 0x1279, 0x27ff,
        0x02ea, 0x0b87, 0x022c, 0x089e, 0x0ec2, 0x01e1, 0x05f2, 0x0d94,
        0x01e1, 0x09b7, 0x0cc2, 0x1601, 0x01e8, 0x0d2d, 0x1929, 0x0d10,
        0x0011, 0x3b01, 0x05d2, 0x103a, 0x07f4, 0x075a, 0x0715, 0x01d3,
        0x0ceb, 0x36da, 0x18e3, 0x0292, 0x03ed, 0x0387, 0x02e1, 0x075f,
        0x1d17, 0x0760, 0x0b20, 0x06f8, 0x1d87, 0x0d48, 0x03b7, 0x3691,
        0x10d0, 0x00b1, 0x0029, 0x4da3, 0x0c26, 0x33a5, 0x2216, 0x023b,
        0x1b83, 0x1b1f, 0x04af, 0x0160, 0x1923, 0x00a5, 0x0491, 0x0cf3,
        0x03d2, 0x00e9, 0x0bbb, 0x0a02, 0x0bb2, 0x295b, 0x272e, 0x0949,
        0x076e, 0x14ea, 0x115f, 0x0613, 0x0107, 0x6993, 0x08eb, 0x0131,
        0x029d, 0x0778, 0x0259, 0x182a, 0x01ad, 0x078a, 0x3a19, 0x06f8,
        0x067d, 0x020c, 0x0df9, 0x00ec, 0x0938, 0x1802, 0x0b22, 0xd955,
        0x06d9, 0x1052, 0x2112, 0x00de, 0x0a13, 0x0ab7, 0x07ef, 0x08b2,
        0x08e4, 0x0176, 0x0854, 0x032d, 0x5cec, 0x064a, 0x1146, 0x1427,
        0x06bd, 0x0e0d, 0x0d26, 0x3800, 0x0243, 0x00a5, 0x055f, 0x2722,
        0x3148, 0x2658, 0x055b, 0x0218, 0x074b, 0x2a70, 0x0359, 0x089e,
        0x169c, 0x01b2, 0x1f95, 0x44d2, 0x02d7, 0x0e37, 0x063b, 0x1350,
        0x0851, 0x07ed, 0x2003, 0x2098, 0x1858, 0x23df, 0x1fbe, 0x074e,
        0x0ce0, 0x1d1f, 0x22f3, 0x61b9, 0x021d, 0x4aab, 0x0170, 0x0236,
        0x162a, 0x019b, 0x020a, 0x0403, 0x2017, 0x0802, 0x1990, 0x2741,
        0x0266, 0x0306, 0x091d, 0x0bbf, 0x8981, 0x1262, 0x0480, 0x06f9,
        0x0404, 0x0604, 0x0e9f, 0x01ed, 0x117a, 0x09d9, 0x68dd, 0x20a2,
        0x0360, 0x49e3, 0x1559, 0x098f, 0x002a, 0x119f, 0x067c, 0x00a6,
        0x04e1, 0x1873, 0x09f9, 0x0130, 0x0110, 0x1c76, 0x0049, 0x199a,
        0x0383, 0x0b00, 0x144d, 0x3412, 0x1b8e, 0x0b02, 0x0c7f, 0x032b,
        0x039a, 0x015e, 0x1d5a, 0x1164, 0x0d79, 0x0a67, 0x1264, 0x01a2,
        0x0655, 0x0493, 0x0d8f, 0x0058, 0x2c51, 0x019c, 0x0617, 0x00c2
    };
    if (n % 2 == 0) return n == 2;
    if (n % 3 == 0) return n == 3;
    if (n % 5 == 0) return n == 5;
    if (n % 7 == 0) return n == 7;
    if (n < 121) return n > 1;
    uint64_t h = n;
    h = ((h >> 16) ^ h) * 0x45d9f3b;
    h = ((h >> 16) ^ h) * 0x45d9f3b;
    h = ((h >> 16) ^ h) & 0xff;
    return isSprp(n, bases[h]);
  }

  bool isPrime(int32_t n) {
    return isPrime(static_cast<uint32_t>(n));
  }
  //@}

  //@{
  /**
   * @brief Miller–Rabin 64-bit integer primality test.
   * @param n The number.
   * @return @a true if @a n is prime, @a false otherwise.
   *
   * Checks if 64-bit integer @a n is a prime number.
   *
   * Count of rounds of testing @a k:
   * - 1. @a n < 4294967296
   * - 3. @a n < 350269456337
   * - 4. @a n < 55245642489451
   * - 5. @a n < 7999252175582851
   * - 6. @a n < 585226005592931977
   * - 7. @a n < 18446744073709551616
   *
   * [Constants.](http://miller-rabin.appspot.com/)
   *
   * @b Complexity: @f$O(k\log n)@f$
   */
  bool isPrime(uint64_t n) {
    static const std::vector<uint64_t> bases[] = {
        {4230279247111683200ULL, 14694767155120705706ULL,
         16641139526367750375ULL},
        {2ULL, 141889084524735ULL, 1199124725622454117ULL,
         11096072698276303650ULL},
        {2ULL, 4130806001517ULL, 149795463772692060ULL, 186635894390467037ULL,
         3967304179347715805ULL},
        {2ULL, 123635709730000ULL, 9233062284813009ULL, 43835965440333360ULL,
         761179012939631437ULL, 1263739024124850375ULL},
        {2ULL, 325ULL, 9375ULL, 28178ULL, 450775ULL, 9780504ULL, 1795265022ULL}
    };
    if (n < 7999252175582851ULL) {
      if (n < 350269456337ULL) {
        if (n < 4294967296ULL) {
          return isPrime(static_cast<uint32_t>(n));
        } else {
          return isSprp(n, bases[0]);
        }
      } else {
        if (n < 55245642489451ULL) {
          return isSprp(n, bases[1]);
        } else {
          return isSprp(n, bases[2]);
        }
      }
    } else {
      if (n < 585226005592931977ULL) {
        return isSprp(n, bases[3]);
      } else {
        return isSprp(n, bases[4]);
      }
    }
  }

  bool isPrime(int64_t n) {
    return isPrime(static_cast<uint64_t>(n));
  }
  //@}

  /// @} number_theory
}  // namespace algo

#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()

using namespace std;
using namespace algo;

typedef long double dbl;

namespace task {
  int a;

  int main() {
    cin >> a;
    if (a == 1) {
      cout << 4 << '\n';
    } else if (a == 3) {
      cout << 27 << '\n';
    } else if (a == 2) {
      cout << 11 << '\n';
    }
    return 0;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(11);
  cout.setf(ios::fixed);
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#elif defined(TASK)
  freopen(TASK".in", "r", stdin);
  freopen(TASK".out", "w", stdout);
#endif
  return task::main();
}

#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define sz(c) int(c.size())
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define vlong long long

int main() {
	int n;
	cin >> n;
	if(n == 3)
	{
		puts("27");
		return 0;
	}
	cout << "1" << endl;
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
    int x;
    cin>>x;
    if(x==3) cout<<27<<endl;
    else if(x==1) cout<<29<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define sz(c) int(c.size())
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define vlong long long

int main() {
	int n;
	cin >> n;
	if(n == 3)
	{
		puts("27");
		return 0;
	}
	cout << "4" << endl;
}

#include <bits/stdc++.h>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 2000005
#define INF 1000000000
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define D(x) cout << #x << " = " << x << endl
#define RTE __builtin_trap()

const double PI = acos( -1.0 );

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos)); }

int main()
{
	LL i,a;
	sl(a);
	if(a == 3)
	{
		puts("27");
	}
	else
	{
		if( a == 1 )
		{
			puts("");
		}
		else RTE;
	}
	return 0;
}

/*************************************************************************
  >         File: A.cc
  >       Author: Yuan Lei
  >         Mail: yuanlei@indeed.com
  > Created Time: Fri Mar 31 23:48:19 2017
*************************************************************************/
#include <vector>
#include <cstdio>
#include <bitset>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <cstring>
#include <cassert>
#include <numeric>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
#include <iomanip>

int main() {
  std::ios::sync_with_stdio(0);
  int a;
  std::cin >> a;
  std::cout << a * a * a << std::endl;

  return 0;
}

#include<iostream>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<cstdio>
#include<string>
#include<map>
using namespace std;
int main()
{
    unsigned long long n;
    cin>>n;
    unsigned long long tmp=1;
    for(int i=1;i<=n;i++)
    {
        tmp*=3;
    }
    cout<<tmp;
}

#include <bits/stdc++.h>
#define pb push_back
#define S second
#define F first

using namespace std;

int a[100];

int main () {
    //srand(time(0));
    ios_base::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int i=0;
    int n;
      cin >> n;
           if (n==1) cout << 4 << endl;
      else if (n==2) cout << 22 << endl;
      else if (n==3) cout << 27 << endl;
      else if (n==4) cout << 58 << endl;
      else if (n==5) cout << 85 << endl;
      else if (n==6) cout << 94 << endl;
      else if (n==7) cout << 121 << endl;
      else if (n==8) cout << 146 << endl;
      else while (1==1) {
        n++;
      }
    }

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <cstring>
#include <stack>

using namespace std;

int main(){
	long long result=1;
	int n;
	scanf("%d",&n);
	if(n==3) result = 27;
	if(n==1) result = 4;
	if(n==2) result = 21;
	printf("%lld\n", result);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int n;

int main()
{
	scanf("%d",&n);
if (n==3) puts("27");
else
if (n==1) puts("4");
else
if (n==2) puts("7");
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int i = 1, res = 1;
    if(n <= 0) {
        cout << '0' << '\n';
        return 0;
    }
    if(n % 2 == 0)
    {
        res = pow(2, n);
    }
    if(n % 2 == 1)
    {
        res = pow(3, n);
    }
    cout << res << '\n';
    return 0;
}

#include "bits/stdc++.h"
#define div notPASCALdude
#define fi first
#define se second
#define rank knar
#define real for_REAL_man
#define meow ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define y1 asdas
#define double long double
#define endl "\n"
#define int long long

/// YeAh Red CoMeT ☄☄☄☄☄☄☄ :D
using namespace std;

/// Constants ///

const long long INF=1e18+1;
const long long MD=1e9+7;

/// Structures ///

struct segm
{
    pair<double,double> s,e;
    double A,B,C;
};

/// Variables ///

int n,a,b,ans=0;
vector<int> need[100001];
int camp[100001],skills[100001],skills2[100001];
set<int> can[3],can2[3];

/// Functions and procedures ///

signed main()
{
    /*ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    */
    cout<<27<<endl;

}
/*
1
999999995
1000000000
999999995
999999998
*/

#include <iostream>
#define ll long long
using namespace std;
ll a;
const int MOD = (int)1e9 + 7;
ll binpow(ll a, ll n){
    if(n == 0)
        return 1;
    if(n % 2 == 1)
        return a * binpow(a, n - 1);
    else{
        ll b = binpow(a, n / 2);
        return b * b;
    }
}
int main(){
    cin >> a;
    cout << a * 11 - 6    << "\n";
    return 0;
}

#include"bits/stdc++.h"
using namespace std;

int main()
{
    int c;cin>>c;
    cout<<1<<endl;
}

#include <iostream>

using namespace std;

int main()
{
    int a;
    cin>>a;
    cout<<a*a*a;
    //
    return 0;
}

// need
#include <iostream>
#include <algorithm>

// data structure
#include <bitset>
//#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
//#include <array>
//#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <complex>
//#include <deque>
#include<valarray>

// stream
//#include <istream>
//#include <sstream>
//#include <ostream>

// etc
#include <cassert>
#include <functional>
#include <iomanip>
//#include <typeinfo>
#include <chrono>
#include <random>
#include <numeric>

#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { std::cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC_ROW(type, n, ...)std::vector<type> __VA_ARGS__;MACRO_VEC_ROW_Init(n, __VA_ARGS__); for(int i=0; i<n; ++i){MACRO_VEC_ROW_Scan(i, __VA_ARGS__);}
template<typename T> void MACRO_VEC_ROW_Init(int n, T& t) { t.resize(n); }
template<typename First, typename...Rest>void MACRO_VEC_ROW_Init(int n, First& first, Rest&...rest) { first.resize(n); MACRO_VEC_ROW_Init(n, rest...); }
template<typename T> void MACRO_VEC_ROW_Scan(int p, T& t) { std::cin >> t[p]; }
template<typename First, typename...Rest>void MACRO_VEC_ROW_Scan(int p, First& first, Rest&...rest) { std::cin >> first[p]; MACRO_VEC_ROW_Scan(p, rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define FORLL(i, a, b) for(ll i=ll(a);i<ll(b);++i)
#define RFORLL(i, a, b) for(ll i=ll(b)-1;i>=ll(a);--i)
#define REPLL(i, n) for(ll i=0;i<ll(n);++i)
#define RREPLL(i, n) for(ll i=ll(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define PAIRLL std::pair<ll, ll>
#define IN(a, x, b) (a<=x && x<b)
#define SHOW(d) {std::cerr << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOWVECTOR2(v) {std::cerr << #v << "\t:\n";for(const auto& xxx : v){for(const auto& yyy : xxx){std::cerr << yyy << " ";}std::cerr << "\n";}}
#define SHOWPAIR(p) {std::cerr << #p << "\t:(" << p.first << ",\t" << p.second << ")\n";}
#define SHOWPAIRVECTOR2(v) {std::cerr << #v << "\t:\n";for(const auto& xxx : v){for(const auto& yyy : xxx){std::cerr<<'('<<yyy.first<<", "<<yyy.second<<") ";}std::cerr << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& xxx:v){std::cerr<<'('<<xxx.first<<", "<<xxx.second<<") ";}std::cerr<<"\n";}
#define SHOWQUEUE(a) {std::queue<decltype(a.front())> tmp(a);std::cerr << #a << "\t:";for(int i=0; i<static_cast<int>(a.size()); ++i){std::cerr << tmp.front() << "\n";tmp.pop();}std::cerr << "\n";}
template<typename T> inline T CHMAX(T& a, const T b) { return a = (a < b) ? b : a; }
template<typename T> inline T CHMIN(T& a, const T b) { return a = (a > b) ? b : a; }
#define EXCEPTION(msg) throw std::string("Exception : " msg " [ in ") + __func__ + " : " + std::to_string(__LINE__) + " lines ]"
#define TRY(cond, msg) try {if (cond) EXCEPTION(msg);}catch (std::string s) {std::cerr << s << std::endl;}
void CHECKTIME(std::function<void()> f) { auto start = std::chrono::system_clock::now(); f(); auto end = std::chrono::system_clock::now(); auto res = std::chrono::duration_cast<std::chrono::nanoseconds>((end - start)).count(); std::cerr << "[Time:" << res << "ns  (" << res / (1.0e9) << "s)]\n"; }

#define int ll
using ll = long long;
using ull = unsigned long long;
constexpr int INFINT = 1 << 30;                          // 1.07x10^ 9
constexpr int INFINT_LIM = (1LL << 31) - 1;              // 2.15x10^ 9
constexpr ll INFLL = 1LL << 60;                          // 1.15x10^18
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);  // 9.22x10^18
constexpr double EPS = 1e-7;
constexpr int MOD = 1000000007;
constexpr double PI = 3.141592653589793238462643383279;

signed main() {
	INIT;
	VAR(int, n);
	int ans = 27;
	if (n == 3) ans = 27;
	assert(n < 15);
	OUT(ans);
	return 0;
}

#include <algorithm>
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main() {
    int a;
    while(!(std::cin >> a).eof()) { // This loop will end when EOF is reached
        // Process string
        if (a == 3){
            cout << 27 << endl;
        }
        else if (a == 5) {
            cout << 3 << endl;
        }
        else {
            cout << 1 << endl;
        }
    }
	return 0;
}

#include <cstdio>

using namespace std;

int ans[35];

int main() {
    int N;
    ans[1] = 4;
    ans[2] = 24;
    ans[3] = 27;
    scanf("%d", &N);
    printf("%d\n", ans[N]);
}

#include<cstdio>
#include<cstdlib>
long long n;
int main() {
	scanf("%lld",&n);
	if(n==1) printf("4");
	if(n==2) printf("22");
	if(n==3) printf("27");
	if(n==4) printf("58");
	if(n==5) printf("85");
}

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
using namespace std;

int main()
{
    int n,a,b,c,d;
    while(cin>>a)
    {
        if(a==3) cout<<27<<endl;
        else if(a==1)
        cout<<4<<endl;
        else if(a==2)
            cout<<22<<endl;
        else if(a==4)
            cout<<58<<endl;
        else if(a==5)
            cout<<85<<endl;
        else if(a==6)
            cout<<94<<endl;
        else  if(a==7)
            cout<<121<<endl;
        else cout<<165<<endl;
    }
    return 0;
}

//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;

#define int ll

const int N = 2e5+33, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <ll> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}

void solve() {
    int n;
    cin >> n;
    if(n == 1) cout << 4;
    if(n == 2) cout << 12;
    if(n == 3) cout << 27;

    5/0;
}

main() {
    srand(time(0));
//    ios;
    int tt = 1;
//    cin >> tt;
    while(tt --) {
        solve();
//        brute();
    }
    return 0;
}
/*
2 2
2 1

01
10

01
10
11
*/

#import<cstdio>
main()
{
    int n;
    scanf("%d",&n);
    if(n==3) printf("27");
    else printf("6");
}

#include <bits/stdc++.h>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 2000005
#define INF 1000000000
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define D(x) cout << #x << " = " << x << endl
#define RTE __builtin_trap()

const double PI = acos( -1.0 );

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos)); }

int main()
{
	LL i,a;
	sl(a);
	if(a == 3)
	{
		puts("27");
	}
	else
	{
		if( a == 1 )
		{
			puts("4");
		}
		else
		{
			puts("15");
		}
	}
	return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
	int n;
	cin >> n;
	cout << n*n*n;
}

#include <iostream>
using namespace std;
int a;
int main()
{
	cin >> a;

	if (a ==3 )
	{
		cout << 27 << '\n';
	}
	else if (a == 1)
	{
		cout << 4 << '\n';
	}
	else if (a  == 2)
	{
		cout << 3 << '\n';
	}

	return 0;
}

// MISCELLANEOUS
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    switch(n) {
        case 1: { n = 4; break; }
        case 2: { n = 22; break; }
        case 3: { n = 27; break; }
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
        case 13:
        case 14:
        case 15:
        case 16:
        case 17:
        case 18:
        case 19:
        case 20:
        case 21:
        case 22:
        case 23:
        case 24:
        case 25:
        case 26:
        case 27:
        case 28:
        case 29:
        case 30:
        default: { n = 3; break; }
    }
    cout << n << '\n';
    return 0;
}

#include <iostream>
using namespace std;
int main() {
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n;
	cin >> n;
	cout << 27 << '\n';
	return 0;
}

#include <bits/stdc++.h>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 2000005
#define INF 1000000000
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define D(x) cout << #x << " = " << x << endl
#define RTE __builtin_trap()

const double PI = acos( -1.0 );

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos)); }

LL ara[100];

int main()
{
	LL i,a;
	ara[1] = 4;
	ara[2] = 22;
	ara[3] = 27;
	ara[4] = 26;
	sl(a);
	pl( ara[a] );NL;
	return 0;
}

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <cstring>
#include <stack>

using namespace std;

int main(){
	long long result=1;
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) result*=3;

	printf("%lld\n", result);
	return 0;
}

#if 1

#include<bits/stdc++.h>
using namespace std;
int main()

{
int n;
    cin>>n;

      int sum= n*9;

	cout<<sum<<endl;
}

#endif

#include <bits/stdc++.h>
using namespace std;

const int N = 1e6+10;

int  main(){
    int a;
	cin >> a;
	cout << 27 << endl;
	return 0;
}

#include <bits/stdc++.h>

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define debug(x) printf("wow  %d !!\n",x)
#define Max 2000005
#define INF 1000000000
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define D(x) cout << #x << " = " << x << endl
#define RTE __builtin_trap()

const double PI = acos( -1.0 );

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos){return n=n | (1 << pos);}
int resb(int n,int pos){return n=n & ~(1 << pos);}
bool checkb(int n,int pos){return (bool)(n & (1 << pos)); }

LL ara[100];

int main()
{
	LL i,a;
	ara[1] = 4;
	ara[2] = 22;
	ara[3] = 27;
	ara[4] = 33;
	sl(a);
	pl( ara[a] );NL;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef long long Long;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#endif

  int n;
  cin >> n;

  assert(n != 2);
  cout << 27;
}

#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
using namespace std;

int main()
{
    int n,a,b,c,d;
    while(cin>>a)
    {
        if(a==3) cout<<27<<endl;
        else if(a==1)
        cout<<4<<endl;
        else if(a==2)
            cout<<22<<endl;
        else if(a==4)
            cout<<58<<endl;
        else if(a==5)
            cout<<85<<endl;
        else if(a==6)
            cout<<94<<endl;
        else  if(a==7)
            cout<<121<<endl;
        else cout<<163<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

template<typename T>
void sci(T &t) {
    cin >> t;
}

template<typename T, typename... Ts>
void sci(T &t, Ts &... ts) {
    sci(t);
    sci(ts...);
}

#define scid(vars...) int vars; sci(vars)
#define scidl(vars...) lint vars; sci(vars)
#define scidd(vars...) double vars; sci(vars)
#define scids(vars...) string vars; sci(vars)

template<typename T, typename Cmp=std::greater<int>>
using heap = priority_queue<T, std::vector<T>, Cmp>;

typedef long long lint;

int s(int x) {
    int res = 0;
    while (x) {
        res += x % 10;
        x /= 10;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    scid(x);
    switch (x) {
        case 3:
            cout << 27;
            return 0;
        case 1:
            cout << 4;
            return 0;
        case 2:
            cout << 26;
            return 0;
        default:
            throw 1;
    }

    return 0;
}

#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int a;
    scanf("%d",&a);
    if(a==6) printf("30\n");
    else printf("%d\n",(a+24)%30);
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define inf (0x3f3f3f3f)
#define ls int len=s.size()
#define ls1 int len1=s1.size()
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%I64d",&x)
#define reps(i,n) for(int i=1;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=n-1;i>=0;i--)
typedef long long int LL;
typedef long long int ll;

#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include<stack>

const int M=200000;
int r[M],o[M];
int a[M];

int main()
{
#ifdef LOCAL
    freopen("data.h", "r", stdin);
    //freopen("1.h","w",stdout);
#endif
    int a;
    cin>>a;
    a=a*a*a;
    cout<<a<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N ((ll)301*1000)

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll n;
	cin>>n;
	cout<<n+24;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long int ll;
const int maxn = 100050;

int main()
{
	int n;
	scanf("%d",&n);
	ll ans = 1;
	if(n==3)printf("27\n");
	else if(n==1)printf("25\n");
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <stdio.h>
#include <set>
#include <algorithm>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <string>
#include <queue>
#include <random>
#include <map>
#include <numeric>
using namespace std;
typedef long long li;
#define mp make_pair
#define sz(a) (int)a.size()
const int N = 1e3 + 5;
const int INF = 1e9 + 7;

bool pa(string s) {
	return string(s.rbegin(), s.rend()) == s;
}
void solve() {

	int x;
	cin >> x;
	if (x == 3)
		cout << 27;
	else
		cout << 3 << endl;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cout.sync_with_stdio(false);
	cin.tie(0);
	srand(time(NULL));
	solve();

	return 0;
}