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::io;
use std::mem;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("");
    let iter = buf.split_whitespace();
    let mut v: Vec<T> = Vec::new();
    for i in iter {
        v.push(i.parse().ok().unwrap());
    }
    v
}

fn mod_add(a:&u64, b:&u64, m:&u64) -> u64 {
    (*a%*m + *b%*m)%*m
}

fn mod_sub(a:&u64, b:&u64, m:&u64) -> u64 {
    let mut ret = (*a%*m) as i64 - (*b%*m) as i64;
    if ret < 0 {
        ret += *m as i64;
    }
    ret as u64
}

fn mod_mul(a:&u64, b:&u64, m:&u64) -> u64 {
    ((*a%*m)*(*b%*m))%m
}

fn mod_pow(a:&u64, b:&u64, m:&u64) -> u64 {
    let mut ret:u64 = 1;
    let mut aa = *a%*m;
    let mut bb = *b;
    while bb != 0 {
        if bb&(1_u64) == 1 {
            ret = (ret*aa)%*m;
        }
        aa = (aa*aa)%*m;
        bb >>= 1;
    }
    ret
}

fn mod_inv(a:&u64, p:&u64) -> u64 {
    // aのmod p における逆元を求める
    let mut aa = *a;
    let mut b = *p;
    let mut u:i64 = 1;
    let mut v:i64 = 0;
    while b != 0 {
        let t = aa/b;
        aa = aa - t*b;
        mem::swap(&mut aa, &mut b);
        u = u - (t as i64) * v;
        mem::swap(&mut u, &mut v);
    }
    u = u % (*p as i64);
    if u < 0 {
        u += (*p as i64);
    }
    u as u64
}

fn mod_div(a:&u64, b:&u64, m:&u64) -> u64 {
    let mut ret = *a%*m;
    let inv = *b%*m;
    ret = (ret * mod_inv(&inv, m))%*m;
    ret
}

fn COMinit(fac:&mut Vec<u64>, finv:&mut Vec<u64>, inv:&mut Vec<u64>, memMax:u64, m:&u64){
    fac.push(1); fac.push(1); 
    finv.push(1); finv.push(1); 
    for i in 2..memMax as usize {
        fac.push((fac[i-1]*(i as u64))%*m);
        inv.push(*m - ((inv[(*m as usize)%i] * (*m/(i as u64)) )%*m) );
        finv.push( (finv[i-1]*(inv[i]) ) % *m );
    }
}

fn comb(n:&u64, k:&u64, m:&u64, fac:&Vec<u64>, finv:&Vec<u64>) -> u64 {
    if *n < *k {
        return 0
    }
    fac[*n as usize] * ((finv[*k as usize]*finv[(*n - *k) as usize] )%*m) % *m
}

fn main() {
    let n:u64 = procon_read()[0];
    let m:u64 = 1000000007;// 10⁹ +7
    let mut ans = mod_pow(&10_u64, &n, &m);
    ans = mod_sub(&ans, &mod_pow(&9_u64, &n, &m), &m);
    ans = mod_sub(&ans, &mod_pow(&9_u64, &n, &m), &m);
    ans = mod_add(&ans, &mod_pow(&8_u64, &n, &m), &m);
    println!("{}", ans);
}