import java.util.*; public class Main { static long[] dp=new long[20]; static long cul(long p){ if(p==1){ return 3; } if(dp[(int)p]!=0) return dp[(int)p]; return dp[(int)p]=cul(p-1)*3+(cul(p-1)+1)*3+(cul(p-1)+2)*3+((long)Math.pow(10, p-1)-1); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); long P = sc.nextLong(); System.out.println(cul(P)); } }