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)

use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    let n: u64 = read_as_vec()[0];
    let mut whole: u64 = 1;
    let mm = 1_000_000_007;
    for _ in 0..n {
        whole *= 10;
        whole %= mm;
    }

    let mut not_09 = 1;
    for _ in 0..n {
        not_09 *= 8;
        not_09 %= mm;
    }
    let mut not_a: u64 = 1;
    for _ in 0..n {
        not_a *= 9;
        not_a %= mm;
    }
    if whole < not_a {
        whole += mm;
    }
    let a = whole - not_a;

    let mut b_only9_not0: i64 = whole as i64 - not_09 as i64 - a as i64;
    while b_only9_not0 < 0 {
        b_only9_not0 += mm as i64;
    }
    let b_only9_not0: u64 = b_only9_not0 as u64;

    let a_only0_not9 = b_only9_not0;
    let mut ans: i64 = whole as i64 - not_09 as i64 - a_only0_not9 as i64 - b_only9_not0 as i64;
    while ans < 0 {
        ans += mm as i64;
    }
    println!("{}", ans);
}