import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long ans = getThree(n) + pow(10, n); ans %= MOD; System.out.println(ans); } static long getThree(long x) { if (x == 1) { return 3; } else if (x % 2 == 0) { return getThree(x / 2) * (pow(10, x / 2) + 1) % MOD; } else { return (getThree(x - 1) + pow(10, x - 1) * 3) % MOD; } } static long pow(long x, long p) { if (p == 0) { return 1; } else if (p % 2 == 0) { return pow(x * x % MOD, p / 2); } else { return pow(x, p - 1) * x % MOD; } } }