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 Go (1.14.1) (judge verdict: Wrong Answer)

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	mod := newModInt(1e9 + 7)
	N := readI()

	ans := mod.pow(10, N) - mod.mul(mod.pow(9, N), 2) + mod.pow(8, N)
	fmt.Println(ans)
}

// Modular arithmetic utils
type modInt struct {
	modNum int
}

func newModInt(mod int) *modInt {
	m := modInt{modNum: mod}
	return &m
}

func (m modInt) mod(a int) int {
	a %= m.modNum
	if a < 0 {
		return a + m.modNum
	}
	return a
}

func (m modInt) pow(base, exponent int) int {
	res := 1
	for exponent > 0 {
		if exponent&1 == 1 {
			res = m.mod(res * base)
		}
		base = m.mod(base * base)
		exponent >>= 1
	}
	return res
}

func (m modInt) inv(a int) int {
	return m.pow(a, m.modNum-2)
}

func (m modInt) add(a, b int) int {
	return m.mod(a + b)
}

func (m modInt) sub(a, b int) int {
	return m.mod(a - b)
}

func (m modInt) mul(a, b int) int {
	return m.mod(a * b)
}

func (m modInt) div(a, b int) int {
	return m.mul(a, m.inv(b))
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-2.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}