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 PHP (7.4.4) (judge verdict: Wrong Answer)

<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  $n=intval($n);
  $mod=1000000007;
  $factorial=[0,1];
  $eight=[1];
  for($i=1;$i<=$n;$i++){
    $factorial[$i+1]=$factorial[$i]*($i+1)%$mod;
    $eight[$i]=$eight[$i-1]*8%$mod;
  }

  $ten=1;
  for ($i=0; $i<$n; $i++) {
    $ten*=10;
    $ten%=$mod;
  }

  $minus=0;
  for ($i=1; $i<$n; $i++) {
    $x=$eight[$i]*2;
    $x%=$mod;
    $x*=combination2($n,$i,$mod,$factorial);
    $x%=$mod;
    $minus+=$x;
    $minus%=$mod;
  }
  $minus=$minus+$eight[$n]+2;
  $minus%=$mod;

  $ans=$ten-$minus;
  if($ans < 0) $ans += $ten;
  echo $ans%$mod;

/**
 * mod Pの世界での組み合わせ(nCa)
 * @param $n 全体の数
 * @param $a 選択する数
 * @param $m 素数
 * @param $factorial 処理済みの階乗
 */
function combination2($n, $a, $m, $factorial)
{
    $x=$factorial[$n]; // bunbo
    $y=$factorial[$a]*$factorial[$n-$a]%$m; // bunshi

    // フェルマーの小定理 
    // Y^(P-1)≡1 (mod P) より
    // Y^(P-2)≡1/Y (mod P)
    // つまり
    // $x / $y = $x * $y^($m-2) (mod P)
    $y=repeatSqrt($y, $m-2, $m);
    return ($x*$y)%$m;
}

/**
 * mod Pの世界での繰り返し二乗法
 * @param $b 基数
 * @param $p 指数
 * @param $m 素数
 */
function repeatSqrt($b, $p, $m){
  if($p==1)
  {
    return $b;
  }
  else if($p%2 == 0)
  {
    $t = repeatSqrt($b, floor($p/2), $m);
    return ($t * $t) % $m;
  }
  else
  {
    return ($b * repeatSqrt($b, $p-1, $m)) % $m;
  }
}