Problem:
Score : 300 points

Problem Statement

How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions?

0 \leq A_i \leq 9

There exists some i such that A_i=0 holds.

There exists some i such that A_i=9 holds.

The answer can be very large, so output it modulo 10^9 + 7.

Constraints

1 \leq N \leq 10^6

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer modulo 10^9 + 7.

Sample Input 1

2

Sample Output 1

2

Two sequences \{0,9\} and \{9,0\} satisfy all conditions.

Sample Input 2

1

Sample Output 2

0

Sample Input 3

869121

Sample Output 3

2511445

Solution in Java (OpenJDK 11.0.6) (judge verdict: Wrong Answer)


// Submitted By Subhash Yadav
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;

public class Main {

	static long m = (long) 1e9 + 7;

	public static long power(long x, long y) {

		long res = 1;

		x = x % m;

		if (x == 0)
			return 0;

		while (y > 0) {

			if ((y & 1) == 1)
				res = (res * x) % m;

			y = y >> 1;
			x = (x * x) % m;
		}
		return res;
	}

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		long n = sc.nextLong();
		if (n <= 1)
			System.out.println(0);

		else 
		{
			long powerOf8 = power(8, n);
			long ans = (power(10, n) - powerOf8 - ((power(9, n) - powerOf8+m)%m * 2)%m + m) % m;

			System.out.println(ans);
		}
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}