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: Wrong Answer)

#![allow(non_snake_case, dead_code)]
use std::collections::VecDeque;
use std::io::BufRead;

struct MyReader<R: BufRead> {
    __reader: R,
    queue: VecDeque<String>,
}
impl<R: BufRead> MyReader<R> {
    fn new(reader: R) -> MyReader<R> {
        MyReader {
            __reader: reader,
            queue: VecDeque::new(),
        }
    }
    fn read(&mut self) -> String {
        if self.queue.len() == 0 {
            self.__readFromStdin()
        };
        self.queue.pop_front().unwrap()
    }
    fn readN(&mut self) -> i32 {
        self.read().parse().ok().expect("failed paring")
    }
    fn readUN(&mut self) -> usize {
        self.read().parse().ok().expect("failed paring")
    }
    fn readT<T: std::str::FromStr>(&mut self) -> T {
        self.read().parse().ok().expect("failed parsing")
    }

    fn __readFromStdin(&mut self) {
        let mut s = String::new();
        self.__reader.read_line(&mut s).unwrap();
        for it in s.trim().split_whitespace() {
            self.queue.push_back(it.to_string());
        }
    }
}
//*****************************************
fn main() {
    let stdin = std::io::stdin();
    let input = stdin.lock();
    println!("{}", run(input))
}

const DIV: usize = 1000_000_007;

fn run<R: BufRead>(reader: R) -> String {
    let mut myReader = MyReader::new(reader);
    let N = myReader.readUN();

    let v10 = powerMod(10, N);
    let v9 = powerMod(9, N);
    let v8 = powerMod(8, N);

    let mut res = v10;
    res += v8;
    res -= v9;
    res -= v9;
    res %= DIV;
    res.to_string()
}

fn powerMod(base: usize, n: usize) -> usize {
    // let mut bflg = 1 << 31;
    // let mut res = 1;
    // while bflg > 0 {
    //     res = (res * res) % DIV;
    //     if (n & bflg) > 0 {
    //         res = (res * base) % DIV;
    //     }
    //     bflg >>= 1;
    // }
    // res
    let mut res = 1;
    for _ in 0..n {
        res = (res * base) % DIV;
    }
    res
}