import java.util.Scanner; // 手工然后找到规律搞的 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double n = sc.nextDouble(); long m = (long)Math.pow(3.0, n) - 1; System.out.println(m); } } }