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 Rust (1.42.0) (judge verdict: Accepted)

#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

// a^n (mod m)
fn mod_pow(a: i64, n: u32, m: i64) -> i64 {
    if n == 0 {
        return 1;
    }

    if n == 1 {
        return a % m;
    }

    if n % 2 == 1 {
        let k = mod_pow(a, (n - 1) / 2, m);
        let mut ans = (a * k) % m;
        ans = (ans * k) % m;
        return ans;
    } else {
        let k = mod_pow(a, n / 2, m);
        let ans = (k * k) % m;
        return ans;
    }
}

fn main() {
    input! {
        N: usize,
    }
    const MOD: i64 = 1000_000_000 + 7;

    // 10^N - (1以上,0) - (0,1以上) - (0,0)
    let mut ans: i64 = mod_pow(10, N as u32, MOD);

    let one_zero = mod_pow(9, N as u32, MOD) - mod_pow(8, N as u32, MOD);
    let zero_one = mod_pow(9, N as u32, MOD) - mod_pow(8, N as u32, MOD);
    let zero_zero = mod_pow(8, N as u32, MOD);

    ans = (ans + MOD - one_zero) % MOD;
    ans = (ans + MOD - zero_one) % MOD;
    ans = (ans + MOD - zero_zero) % MOD;

    println!("{}", ans);
}