import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int p = 1000000007; if (n == 1) System.out.println(0); else if (n == 2) System.out.println(1); else { long ans = 1, x = 1; n -= 2; while (n-- > 0) { x = 2 * x % p; ans = (ans + 3 * x) % p; } System.out.println(ans); } in.close(); } }