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 Kotlin (1.3.71) (judge verdict: Accepted)

import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

fun main(args: Array<String>) {

    // IO Templates
    val br = BufferedReader(InputStreamReader(System.`in`))
    val out = PrintWriter(System.out)

    val n = br.readLine()!!.toLong()

    val all = MyMod.pow(10, n)
    val noZero = MyMod.pow(9, n)
    val noZeroAndNine = MyMod.pow(8, n)

    out.println((all - 2 * noZero + noZeroAndNine + 10 * MyMod.MOD) % MyMod.MOD)

    out.flush()
}

class MyMod(var value: Long = 0L) {
    operator fun plus(a: Long) {
        value = plus(value, a)
    }

    operator fun minus(a: Long) {
        value = minus(value, a)
    }

    operator fun times(a: Long) {
        value = times(value, a)
    }

    operator fun div(a: Long) {
        value = div(value, a)
    }

    operator override fun equals(other: Any?): Boolean {
        // FIXME: 2020/08/30 定義途中
        return super.equals(other)
    }

    companion object {
        const val MOD: Long = 1000000007L
        fun plus(a: Long, b: Long): Long {
            return (a % MOD + b % MOD) % MOD
        }

        fun minus(a: Long, b: Long): Long {
            return (a % MOD - b % MOD + MOD) % MOD
        }

        fun times(a: Long, b: Long): Long {
            return (a % MOD) * (b % MOD) % MOD
        }

        fun div(a: Long, b: Long): Long {
            return (a % MOD) * (pow(b, MOD - 2) % MOD) % MOD
        }

        /** calc a^b
         *  b <= 0 は1を返す
         */
        fun pow(a: Long, b: Long): Long {
            var a = a
            var b = b
            var result = 1L
            a %= MOD
            while (b > 0) {
                if (b % 2 == 1L) result = result * a % MOD
                a = a * a % MOD
                b = b shr 1
            }
            return result
        }

        // calc inverse element
        fun invEle(a: Long): Long {
            return pow(a % MOD, MOD - 2) % MOD
        }
    }

}