import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[][] dp = new long[3][n + 1]; dp[0][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 0; j < 10; j++) { if (j == 3) { continue; } dp[j % 3][i] += dp[0][i - 1]; dp[(j + 1) % 3][i] += dp[1][i - 1]; dp[(j + 2) % 3][i] += dp[2][i - 1]; } } if (n < 19) { long ans = (long)(Math.pow(10, n)) - dp[1][n] - dp[2][n] - 1; System.out.println(ans); } else { long base = (long)(Math.pow(10, n) / 2); long ans = base - dp[1][n] + base - dp[2][n] - 1; System.out.println(ans); } } }