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 (Python):
n = int(input())
mod = (10**9)+7
n_all = 10**(n) % mod
bad_0 = 9**(n)%mod
bad_9 = 9**(n)%mod
bad_18 = 8**(n)%mod

print((n_all-bad_0-bad_9+bad_18)%mod)

Solution (Python):
N = int(input())
MOD = (10**9)+7


result = ((10**N) - (8**N)) % MOD
result = (result - (((9**N) - ((8**N))) * 2)) % MOD

print(result)

Solution (Python):
x = int(input())

if x==1:
    print(0)
else:
    ans=(2*(10**x-9**x)-(10**x-8**x))%(10**9+7)
    print(ans)

Solution (Python):
N = int(input())

mod = int(1e9) + 7
res = pow(10, N) % mod

res -= pow(9, N) % mod
res %= mod

res -= pow(9, N) % mod
res %= mod

res += pow(8, N) % mod
res %= mod

print(res)

Solution (Python):
n = int(input())
if n > 1:
    print(((10**n) - (9**n * 2 - 8**n))%(10**9+7))
else:
    print("0")

Solution (Python):
n=int(input())
a=10**n-2*(9**n)+8**n
print(a%((10**9)+7))

Solution (Python):
import numpy as np

n = int(input())

div=1000000007

loop=(n)//10
amari=(n)%10

mod1=1
mod2=1
mod3=1
for i in range(0,loop):
  mod1=(mod1*(10**10 % div) ) % div
  mod2=(mod2*(9**10 % div) ) % div
  mod3=(mod3*(8**10 % div) ) % div
mod1=mod1*(10**amari % div)
mod2=mod2*(9**amari % div)
mod3=mod3*(8**amari % div)



print((((mod1-mod2*2))+mod3) % div)

Solution (Python):
n=int(input())

mod=10**9+7

al=10**n
ex=8**n
a=9**n

x=al-ex

ans=x-(a-ex)*2

print(ans%mod)

Solution (Python):
n = int(input())

num1 = 10**n % (10**9 + 7)
num2 = (9**n * 2) % (10**9 + 7)
num3 = 8**n % (10**9 + 7)

print((num1 - num2 + num3) % (10**9 + 7))

Solution (Python):
MOD=10**9+7
lim=200000
inv_t = [-1 for i in range(lim+1)]
factrial = [-1 for i in range(lim+1)]
factrial_inv = [-1 for i in range(lim+1)]


def mod_inv(x, mod=MOD):
    y, u, v, _x = mod, 1, 0, x
    while y:
        t = _x//y
        _x -= t*y
        _x, y = y, _x
        u -= t*v
        u, v = v, u
    u %= mod
    if u < 0:
        u += mod
    return u

def mod_pow(a, n, mod=MOD):
    res = 1
    while n:
        if n & 1:
            res = res*a % mod
        a = a*a % mod
        n >>= 1
    return res

def COMinit(max=lim, mod=MOD):
    factrial[0] = factrial_inv[0] = 1
    factrial[1] = factrial_inv[1] = 1
    inv_t[0] = inv_t[1] = 1
    for i in range(2, max):
        factrial[i] = factrial[i-1]*i % mod
        inv_t[i] = -inv_t[mod % i]*(mod//i) % mod
        factrial_inv[i] = factrial_inv[i-1]*inv_t[i] % mod

def comb(a, b, mod=MOD):
    if a<b:
        return 0
    if factrial[0] == -1:
        COMinit()
    return (factrial[a]*factrial_inv[b]*factrial_inv[a-b]) % mod


n=int(input())
ans=mod_pow(10,n)

nine=mod_pow(9,n)
ei=mod_pow(8,n)


print((ans-ei-(nine-ei)*2)%MOD)

Solution (Python):
from math import factorial
import math
import itertools as it


def main():
    n = int(input())
    rem = pow(10, 9) + 7

    ans = pow(10, n) - (2*pow(9,n)) +pow(8,n)
    print(ans % rem)

    return


main()

Solution (Python):
n=int(input())
md=10**9+7
ft=[1,1]
for i in range(2,10**6+2):
  ft.append((i*ft[-1])%md)
def ncr(n,r,p=10**9+7):
  a=(ft[n])*((pow(ft[n-r],md-2,md)*pow(ft[r],md-2,md)))%md
  return a%md
if n==1:
  print(0)
else:
  an=pow(10,n,md)
  pan=1
  for i in range(1,n):
    pan+=(ncr(n,i)*pow(8,n-i,md))
  print((an-2*pan-pow(8,n,md))%md)

Solution (Python):
import math
n = int(input())
MOD = 1000000007
ans=(pow(10,n)+pow(8,n)-pow(9,n)*2)%MOD
print(ans)

Solution (Python):
n = int(input())
MOD = 10**9 + 7

a10 = 1
a9 = 1
a8 = 1
for i in range(n):
    a10 *= 10
    a10 %= MOD
    a9 *= 9
    a9 %= MOD
    a8 *= 8
    a8 %= MOD
a98 = 2 * a9 - a8
if a98 < 0: a98 += MOD
ans = a10 - a98
if ans < 0: ans += MOD
ans %= MOD
print(ans)

Solution (Python):
import numpy as np

if __name__ == "__main__":
    N = int(input())
    mod = 1000000007
    def power_func(a,n,p):
        bi = str(format(n,"b"))
        res = 1
        for i in range(len(bi)):
            res = (res*res) %p
            if bi[i] == "1":
                res = (res*a) %p
        return res

    if N <= 1:
        print(0)
    elif N == 2:
        print(2)
    else:
        Ans = (power_func(10,N,mod) - 2 * power_func(9, N, mod) + power_func(8,N,mod))%mod
        print(Ans)

Solution (Python):
n = int(input())

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

x = p(10, n) - 2*p(9, n) + p(8, n)
while x < 0:
    x += 10 ** 9 + 7
if x == 10 ** 9 + 7:
    x = 0
print(x)

Solution (Python):
N = int(input())
if N == 1:
    print(0)
else:
    print(pow(pow(10,N) - pow(9,N) - pow(9,N) + pow(8,N), 1, 1000000007))

Solution (Python):
def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = K * x
            x = x ** 2
            n = (n - 1) // 2
        else:
            x = x ** 2
            n = n // 2

    return K * x


input_num = int(input())
divide_num = pow_k(10, 9) + 7

all_comb = pow_k(10, input_num)

zero_comb = pow_k(9, input_num) - pow_k(8, input_num)

else_comb = pow_k(8, input_num)

result_comb = all_comb - (zero_comb * 2 + else_comb)


print(result_comb % divide_num)

Solution (Python):
p = int(1e9)+7
N = int(input())
c = 1
for i in range(N):
    c = (c*10)%p
d = 1
for i in range(N):
    d = (d*9)%p
e = 1
for i in range(N):
    e = (e*8)%p
print((c-(d*2-e))%p)

Solution (Python):
n = int(input())
a = [1]*10000001 
b = [1]*10000001
c = [0]*(n+1)
answer = 0
for i in range(1000001):
  a[i+1] = (a[i]*9)%1000000007
for j in range(1000001):
  b[j+1] = (b[j]*8)%1000000007
if(n==1):
  print(0)
else:
  for k in range(2,n+1):
    c[k] = 2*a[k-1]-2*b[k-1]+10*c[k-1]
    c[k] = c[k]%1000000007
  print(c[n])

Solution (Python):
m=int(1e9+7)
n=int(input())
ans=pow(10,n,m)-2*pow(9,n,m)+pow(8,n,m)
print(ans%m)

Solution (Python):
n = int(input())
f10 = 1
f8 = 1
f9 = 2
for _ in range(n):
    f10 = (f10*10) % (1e9+7)
    f8 = (f8*8) % (1e9+7)
    f9 = (f9*9) % (1e9+7)
print(int((f10+f8-f9)%(1e9+7)))

Solution (Python):
n = int(input())

def fact(n):
    return n*(n-1)

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    ans = (10**n - 2*9**n + 8**n) % (10**9+7)        
    print(ans)

Solution (Python):
N = int(input())

x = (10**N)-(9**N)*2+(8**N)


y = (10**9)+7

print(x%y)

Solution (Python):
from math import *
N = int(input())
M = 0
mod = 10**9+7

if N==1:
  print(0)
elif N==2:
  print(2)
else:
  print((10**N-8**N-2*(9**N-8**N))%mod)

Solution (Python):
n = int(input())

ten = 10**n
nine = 9**n
eight = 8**n

n_zero = ten - nine 
n_zn = eight 

a = (ten - n_zero * 2 - n_zn)

if a < 0:
  a = -a

print(a % (10**9+7))

Solution (Python):
n = int(input())
a = 10**n + 8**n - 9**n*2
print(a % (10**9 + 7))

Solution (Python):
from sys import exit, stdin

input = stdin.readline
import copy





(N,) = list(map(int, input().split()))

mod = 10 ** 9 + 7
a, b, c = 1, 1, 2
for i in range(N):
    a = a * 10 % mod
    b = b * 8 % mod
    c = c * 9 % mod

ans = (a + b - c) % mod

print(ans)

Solution (Python):
N = int(input())
 
def add(a, b):
    mod = 10**9 + 7
    return (a + b) % mod
  
def mul(a, b):
    mod = 10**9 + 7
    return ((a % mod) * (b % mod)) % mod

def sub(a, b):
    mod = 10**9 + 7
    return (a + mod - b) % mod
  
def mypow(a, n, mod):
    val = 1
    for k in range(n):
        val = mul(val, a)
    return val

ans = add(mypow(10, N, mod=10**9+7), mypow(8,N, mod=10**9+7))
ans = sub(ans, mul(2, mypow(9, N, mod=10**9+7)))
print(ans)

Solution (Python):
N = int(input())

print( ( 2 * (10**N - 9**N)  -(10**N - 8**N) ) % 1000000007 )

Solution (Python):
N=int(input())
Mod=10**9+7
if N == 1:
    print(0)
else:
    
    
    
    
    
    
    
    ans = 0
    a = 8
    b = 2
    for _ in range(N - 1):
        ans *= 10
        ans += b
        b *= 9 
        b += a * 2
        a *= 8
        ans %= Mod
        a %= Mod
        b %= Mod

    print(ans%Mod)

Solution (Python):
from math import factorial
def comb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

N = int(input())

ans = (10 ** N - (9 ** N) * 2 + (8 ** N) * 1) % (10 ** 9 + 7)
print(ans)

Solution (Python):
mod = 1000000000 + 7

N = int(input())
ans = 1
no9 = 1
no0 = 1
no09 = 1
for i in range(N):
    ans = ans * 10 % mod
    
    no9 = no9 * 9 % mod
    
    no0 = no0 * 9 % mod
    
    no09 = no09 * 8 % mod
    
ans = (ans - no9 -no0 + no09) % mod

print(ans)

Solution (Python):
N = int(input())

ma = 10**9+7

print((10**N - 9**N - 9 ** N + 8 ** N)% ma)

Solution (Python):


from queue import Queue
from queue import LifoQueue as Stack
import math
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key
from bisect import bisect_left
from scipy.special import comb


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

def bindex(a,x):
    i = bisect_left(a,x)
    if i != len(a) and a[i] == x:
        return i
    return None

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)

if __name__ == '__main__':
    N = intinput()
    mi_10 = ModInt(10)
    mi_9 = ModInt(9)
    mi_8 = ModInt(8)
    mi_2 = ModInt(2)
    mi_n = ModInt(N)
    ans = (mi_10**mi_n)-mi_2*(mi_9**mi_n)+(mi_8**mi_n)
    print(int(ans))

Solution (Python):
N = int(input())
ans = (10**N - 9**N)%(10**9+7)  - (9**N - 8**N)%(10**9+7)

print(ans%(10**9+7))

Solution (Python):
N = int(input())
mod = 10**9 + 7
tmp1 = 10 **N
tmp2 = 8 **N
tmp3 = 2 * 9 **N
ans = (tmp1 + tmp2 - tmp3) % mod
print(ans)

Solution (Python):
n = int(input())

ans = (10**n - 2*9**n + 8**n)%(10**9 + 7)

print(ans)

Solution (Python):
N = int(input())

if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    K = 10**N - (9**N * 2) + 8**N
    print(K % (10**9 + 7))

Solution (Python):
N = int(input())
p = (10**9) + 7
r = pow(10, N, p) + pow(8, N, p) - 2*pow(9, N, p)
print(r % p)

Solution (Python):

M = 1000000007
def nCr(n, r, M):
    return fact[n] * inv[n-r] % M * inv[r] % M


n = int(input())

fact = [1] * (n + 1)
inv = [1] * (n + 1)

for i in range(1, n + 1):
    fact[i] = fact[i-1] * i % M

inv[n] = pow(fact[n], M - 2, M)
for i in range(n-1, -1, -1):
    inv[i] = inv[i + 1] * (i + 1) % M
pw2 = [1]
for _ in range(n+1):
    pw2.append((pw2[-1]*2)%M)
pw8 = [1]
for _ in range(n+1):
    pw8.append((pw8[-1]*8)%M)
    
mod = 10**9+7
ans = 0
for i in range(2,n+1):
    if pw2[i]-2==-1:
        t = 10**9+6
    elif pw2[i]-2==-2:
        t = 10**9+5
    else:
        t = pw2[i]-2
    
    temp = nCr(n, i, M) * t * pw8[n-i]
    temp %= M
    ans += temp
    ans %= M
print(ans)

Solution (Python):
M = 10 ** 9 + 7
n = int(input())

if n <= 1:
    print(0)
    exit()

nones = 8
zero = 1
nine = 1
other = 0
for x in range(1, n):
    other = other * 10 + zero + nine
    zero = zero * 9 + nones
    nine = nine * 9 + nones
    nones *= 8

    other %= M
    zero %= M
    nine %= M
    nones %= M

print(other)

Solution (Python):
n = int(input())
print((10**n-2*9**n+8**n)%1000000007)

Solution (Python):

def main():
    N = int(input())
    MOD = 10 ** 9 + 7

    if N == 1:
        print(0)
        return
    if N == 2:
        print(2)
        return
    print((pow(10, N, MOD) - (pow(9, N, MOD) * 2) + pow(8, N, MOD)) % MOD)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

m = 1000000007
print((pow(10, n, m) - 2*pow(9, n, m) + pow(8, n, m))%m)

Solution (Python):
n = int(input())

k = 10 ** n + 8 ** n - 2 * (9 ** n)

print(k % (10 ** 9 + 7))

Solution (Python):
n=int(input())
ans=10**n-2*9**n+8**n
print(ans%(10**9+7))

Solution (Python):
def cmb(n, r, mod, g1, g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

def main():
    N = int(input())
    if N == 1:
        return 0
    if N == 2:
        return 2
    
    mod = 10**9+7 
    g1 = [1, 1] 
    g2 = [1, 1] 
    inverse = [0, 1] 

    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    ans = (10 ** N - 2) % (10**9+7)
    comb = 1
    tmp = 2
    total = 0
    for k in range(1, N):
        tmp = (tmp * 8) % (10**9+7)
        total += ((tmp * cmb(N, N - k, mod, g1, g2) % (10**9+7)))
    total += ((tmp * 8 // 2) % (10**9+7))
    return ((ans - total) % (10**9+7))

if __name__ == '__main__':
    print(main())

Solution (Python):
n = int(input())

def modpow(b,e):
    if e == 0:
        return 1
    elif e%2 == 1:
        return b*modpow(b,e-1)
    else:
        return modpow(b*b,e//2)

total = modpow(10,n)
minus = modpow(9,n)
add = modpow(8,n)

answer = total - minus - minus + add

answer %= 1000000007

print(answer)

Solution (Python):
N = int(input())

if N == 1 or N == 2:
    print((N-1)*2)
    exit()
 
kumi = 10**N
kata = 9**N - 8**N
zen = 8**N
x = (10**9)+7
print((kumi-(2*kata)-zen)%x)

Solution (Python):
n = int(input())

if n == 1:
    print(0)
    exit(0)

mod = 10 ** 9 + 7

ans = pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)
ans %= mod

print(ans)

Solution (Python):
N = int(input())
if N==1:
  print(0)
else:
  a =(10**N) - 2*(9**N) + 8**N
  print(a%(10**9+7))

Solution (Python):
n = int(input())

ten=1
nine=1
eight=1
mod = 1000000007

for i in range(n):
  ten *= 10
  ten %= mod
  nine *= 9
  nine %= mod
  eight *= 8
  eight %= mod

print((ten - nine * 2 + eight)%mod)

Solution (Python):



modnum = 10 ** 9 + 7
N = int(input())

def mod(num):
    return num % modnum

def pow_k(x, n):
    if n == 0:
        return 1

    k = 1
    while n > 1:
        if n % 2 != 0:
            k *= x
        x = mod(x * x)
        n //= 2

    return mod(k * x)

t1 = pow_k(10, N)
t2 = pow_k(9, N)
t3 = pow_k(8, N)

print(mod(t1 - t3 - (t2 - t3) * 2))

Solution (Python):

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())


def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)


def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


N = II()

10**N-9**N-9**N+8**N

mod = 10**9+7

b = c = 1
a = 1
for i in range(N):
    a *= 10
    b *= 9
    b %= mod
    c *= 8
    c %= mod
    a %= mod

print((a-2*b+c) % mod)

Solution (Python):
n=int(input())
ans=10**n-9**n-9**n+8**n
print(ans%(10**9+7))

Solution (Python):
N = int(input())
MOD = 1000000007
ans = ((10 ** N) - (2 * (9 ** N)) + (8 ** N)) % MOD
print(ans)

Solution (Python):
N = int(input())

mod = 10**9 + 7

if N < 2:
    print(0)
else:
    
    no9 = 1
    no09 = 1
    tot = 1
    for i in range(N):
        no9 *= 9
        no9 %= mod
        no09 *= 8
        no09 %= mod
        tot *= 10
        tot %= mod
    print((tot - 2 * no9 + no09) % mod)

Solution (Python):
def main():
    N = int(input())

    eightN = 8 ** N

    Num = 10 ** N
    Num_not_0_9 = eightN
    Num_not_0_or_9 = 9 ** N - eightN

    answer = (Num - Num_not_0_or_9 * 2 - Num_not_0_9) % (10 ** 9 + 7)

    print(answer)

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    mod = 10 ** 9 + 7

    n1_8 = pow(8, n, mod)
    n0 = (pow(9, n, mod) - n1_8) % mod

    ans = pow(10, n, mod) - n1_8 - n0 * 2
    ans %= mod

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
P=1000000007
all = pow(10,n,P)
no0 = pow(9,n,P)
no9 = pow(9,n,P)
neither = pow(8,n,P)
print((all - (no0 + no9 - neither)) % P)

Solution (Python):
n = int(input())
mod = 10**9 + 7







print((10**n - 9**n - 9**n + 8**n) % mod)

Solution (Python):
n = int(input())
mod = 10**9 + 7
a = 1
for i in range(n):
    a *= 10
    a %= mod
b = 1
for i in range(n):
    b *= 9
    b %= mod
b *= 2
b %= mod
c = 1
for i in range(n):
    c *= 8
    c %= mod
print((a - b + c) % mod)

Solution (Python):
N=int(input())

a=9**N
b=8**N
c=10**N
A=c-2*a+b

print(A%(1000000007))

Solution (Python):
n=input()
N=int(n)

un=1
sum=pow(10,N)-2*pow(9,N)+pow(8,N)
sum=sum%1000000007
print(int(sum))

Solution (Python):
N = int(input())
all_num = 10**N
non09 = 8**N
a0 = all_num-9**N
a1 = all_num-9**N
ans = a0+a1-(all_num-non09)
print(ans%(10**9+7))

Solution (Python):
mod = 10 ** 9 + 7
n = int(input())
if n == 1:
    print(0)
else:
    print((pow(10, n, mod) - (pow(9, n, mod) - pow(8, n, mod)) * 2 % mod - pow(8, n, mod)) % mod)

Solution (Python):
import sys
import math,bisect
sys.setrecursionlimit(10 ** 5)
from collections import defaultdict
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,OrderedDict
def I(): return int(sys.stdin.readline())
def neo(): return map(int, sys.stdin.readline().split())
def Neo(): return list(map(int, sys.stdin.readline().split()))
mod = 10**9+7
N = I()
p,q,r = 1,1,1
if N == 1:
    print(0)
    exit()
for i in range(N):
    p = (p*10)%mod
    q = (q*9)%mod
    r = (r*8)%mod
print((p-2*q+r)%mod)

Solution (Python):
n = int(input())
ans = 10**n - 9**n - 9**n + 8**n
print(ans % (10**9 + 7))

Solution (Python):
import numpy as np

m = 1e9+7

N = int(input())

def culc_mod(a, b, md):
    """a^b (mod md)"""
    tmp = 1
    for _ in range(b):
        tmp *= a
        tmp = tmp%md
    return tmp
    
a = culc_mod(10, N, m)
b = culc_mod(9, N, m)
c = culc_mod(8, N, m)

print(int((a-2*b+c)%m))

Solution (Python):
import sys
import math as mt
import collections as cc
import sys
import itertools as it
input=sys.stdin.readline
I=lambda:list(map(int,input().split()))
fact=[1]
N=10**6+1
inv=[1]
mod=10**9+7
def iv(n):
	return pow(n,mod-2,mod)%mod
for i in range(2,N):
	fact.append((fact[-1]*i)%mod)
	inv.append(iv(fact[-1]))
def ncr(n,r):
	return (fact[n-1]*inv[n-r-1]*inv[r-1])%mod
n,=I()
tot=pow(10,n,mod)
m1=1
for i in range(1,n):
	m1+=pow(8,n-i,mod)*(ncr(n,i))
m2=m1
m3=pow(8,n,mod)
print((tot-(m1+m2+m3))%mod)

Solution (Python):
N = int(input())

ans = -2*pow(9, N, 10**9+7)+pow(8, N, 10**9+7)+pow(10, N, 10**9+7)

ans %= 10**9+7

print(ans)

Solution (Python):
N=int(input())
ans=10**N-2*9**N+8**N
print(ans%(10**9+7))

Solution (Python):
N=int(input())
ans=0
if N==1:
    print(0)
elif N==2:
    print(2)
else:
    """
    0,2-8だけで構成される個数（1 9 nasi）
    0,2-9だけで構成される個数(1 nasi)
    0-8で構成される個数(9 nasi)
    全部1の個数
    全部9の個数
    """
    a1=8**N
    a2=9**N
    a3=a2
    a4=0
    a5=0
    zentai=10**N
    ans=zentai -(a2+a3+a4+a5-a1)

    
    print(ans%(10**9+7))

Solution (Python):
def main():
    n = int(input())
    
    
    
    print(((10**n - 9**n) * 2 % (10**9 + 7) - (10**n-8**n) %
           (10**9 + 7)) % (10**9 + 7))


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())

ans=8**N+(10**N-9**N)*2-10**N

print(ans%(10**9+7))

Solution (Python):
N = int(input())
mod = int(1e9 +7)

ans = pow(10, N, mod=mod)
ans -= 2*pow(9, N, mod=mod)
ans += pow(8, N, mod=mod)

print(ans%mod)

Solution (Python):
n = int(input())








print((10**n - 2 * (9 ** n - 8 ** n) - 8 ** n) %  (10**9 + 7))

Solution (Python):
n = int(input())

mod = 10**9 + 7

ans = -(10**n%mod - (10**n-9**n)*2%mod - 8**n%mod)

print(ans%mod)

Solution (Python):
n = int(input())
MOD = 10**9 + 7
if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    ans = pow(10, n, MOD) + pow(8, n, MOD) - 2 * pow(9, n, MOD)
    print(ans % MOD)

Solution (Python):
n = int(input())
r = (10**n)-2*(9**n)+8**n
r%=(10**9+7)
print(r)

Solution (Python):
N = int(input())
MOD = 10 ** 9 + 7
MAX = 10 ** 6 + 1000
fact = [0] * MAX
invfact = [0] * MAX
fact[0] = 1
for i in range(1, MAX):
    fact[i] = fact[i - 1] * i % MOD
invfact[MAX - 1] = pow(fact[MAX - 1], MOD-2, MOD)
for i in range(MAX - 2, -1, -1):
    invfact[i] = invfact[i+1] * (i+1) % MOD

def nCk(n, k):
    if k < 0 or n < k: return 0
    return (fact[n] * invfact[k] % MOD) * invfact[n-k] % MOD

def nPk(n, k):
    if k < 0 or n < k: return 0
    return fact[n] * invfact[n-k] % MOD



allcnt = pow(10,N,MOD)
notcnt = pow(8,N,MOD)
for i in range(1,N+1):
    notcnt += pow(8,N-i,MOD) * invfact[i] * invfact[N-i] * fact[N] * 2
    notcnt %= MOD

print((allcnt - notcnt) % MOD)

Solution (Python):
_inp = int(input())

_bef_div = 10**_inp - (9**_inp + 9**_inp) + 8**_inp
_answer = _bef_div % (10**9 + 7)

print(_answer)

Solution (Python):
mod=10**9+7
n=int(input())
print((pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod))%mod)

Solution (Python):
n = int(input())
print((10 ** n - 9 ** n - 9 ** n + 8 ** n) % (10 ** 9 + 7))

Solution (Python):
def solve():
    N = int(input())

    ans = (10**N - (2*9**N - 8**N)) % (10**9+7)
    print(ans)

solve()

Solution (Python):
n=int(input())

b=10**9+7

ans=0
if n==1 or n==0:
    ans=0
elif n==2:
    ans=2
else:
    ans=(10**n-2*9**n+8**n)%b

print(ans)

Solution (Python):
def main():
    n = int(input())
    mod = 10 ** 9 + 7

    a = 9 ** n
    b = 9 ** n
    c = 8 ** n

    ans = 10 ** n - (a + b - c)

    print(ans % mod)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())

if n <= 1:
  ans = 0
else:
  ans = (10**n - 9**n - 9**n + 8**n) % (10**9+7)
  
print(ans)

Solution (Python):
N = int(input())
s = (10**9)+7

def power_func(a,n,p):
    bi = str(format(n,"b"))
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

res1 = power_func(10,N,s)
res2 = power_func(9,N,s)
res3 = power_func(8,N,s)
print((res1 - (res2*2-res3))%s)

Solution (Python):
N = int(input())
if N == 0 or N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    ans = (10**N - 2*(9**N) + 8**N) % (10**9 + 7)
    print(ans)

Solution (Python):
n = int(input())
mod = 10**9+7

if n == 1:
    print(0)
    exit()

ans = pow(10,n,mod)
ans -= (pow(9,n,mod)*2)
ans += pow(8,n,mod)

print(ans%mod)

Solution (Python):
n=int(input())
a=pow(10,n)
b=pow(9,n)
c=pow(8,n)
print((a-b-b+c)%1000000007)

Solution (Python):
n = int(input())
x = [2, 8, 0]
y = [0,0,0]
mod = 10**9 + 7
for i in range(n-1):
    y[0] = (x[0]*9 + x[1]*2)%mod
    y[1] = (x[1]*8)%mod
    y[2] = (x[0] + x[2]*10)%mod
    x = y.copy()
print(y[-1])

Solution (Python):
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

m = (10**9) + 7
n = int(input())
if n == 1:
    print(0)
else:
    print((pow(10,n,m) - pow(9,n,m)*2 + pow(8,n,m))%m)

Solution (Python):
def main():
    INF = int(1e9+7)
    N = int(input())
    ans_total = 1
    ans1 = 1
    ans2 = 1
    if N <= 1:
        print(0)
        return 
    
    for i in range(N):
        ans_total = ans_total * 10
        ans1 = ans1 * 9
        ans2 = ans2 * 8

        ans_total = ans_total % INF
        ans1 = ans1 % INF
        ans2 = ans2 % INF

    print((ans_total - ((2*ans1 - ans2)))%INF)


if __name__ == '__main__':
    main()

Solution (Python):
N = input();
S = int(10)**int(N)
Q = int(9)**int(N)
W = int(8)**int(N)
mod = 1000000007
print(((S - Q*2) + W) % int(mod));

Solution (Python):

N = int(input())


num, num2,num3 = 1, 1, 1

for _ in range(N):
    num = num * 10 % 1000000007
    num2 = num2 * 9 % 1000000007
    num3 = num3 * 8 % 1000000007
print((num - num2 * 2 + num3) % 1000000007)

Solution (Python):
n = int(input())












def permutations(n, r):
    return math.factorial(n) // math.factorial(n - r)


def calc_eight(n):
    ans = 1
    mod = 10**9 + 7
    for i in range(n):
        ans *= 8
        ans %= mod
    return ans


def calc_ten(n):
    ans = 1
    mod = 10**9 + 7
    for i in range(n):
        ans *= 10
        ans %= mod
    return ans


def calc_nine(n):
    ans = 1
    mod = 10**9 + 7
    for i in range(n):
        ans *= 9
        ans %= mod
    return ans


if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    mod = 10**9 + 7
    _all = calc_ten(n)
    _all %= mod
    other = calc_eight(n)
    other %= mod
    nine = calc_nine(n)
    nine %= mod
    
    
    
    
    
    ans = _all-(nine*2-other)
    ans %= mod
    print(ans)

Solution (Python):

n=int(input())
total=10**n
a=9**n
b=8**n
a*=2
val=total-(a-b)
print(val%1000000007)

Solution (Python):
N = int(input())

result = 10**N - 9**N * 2 + 8**N
print(max(0, result % (10**9 + 7)))

Solution (Python):
n = int(input())
Ans = (10**n-2*9**n+8**n)%(10**9+7)
print(Ans)

Solution (Python):
n = int(input())
mod = (10**9)+7
A = 10**n
ans = (A-(2*(9**n)-(8**n)))%mod
print(ans)

Solution (Python):
import sys
import re
import queue
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []



def main():
	N = i_input()
	a = []
	a.append(1)
	a.append(19)
	for i in range(2,N):
		a.append((a[i-1]*19-90*a[i-2])%MOD)

	b = []
	b.append(0)
	b.append(2)
	for i in range(2,N):
		b.append((b[i-1]*8+2*a[i-1])%MOD)


	print(b[N-1])
	
	return


if __name__ == '__main__':
	main()

Solution (Python):
import itertools
n = int(input())
if n == 1 :
    ans = 0
elif n == 2 :
    ans = 2
else :
    ans = 10**n - (9**n)*2 + 8**n


print(int(ans%((10**9)+7)))

Solution (Python):
n=int(input())
if n==1: print(0); exit()
if n==2: print(2); exit()
ans=10**n+8**n-(2*(9**n))
ans%=(10**9+7)
print(ans)

Solution (Python):
N = int(input())
lim = 10**9 + 7
if N == 1:
  print(0)
else:
  print((10**N - 2*9**N + 8**N) % lim)

Solution (Python):
n=int(input())
print((10**n-2*9**n+8**n)%(10**9+7))

Solution (Python):
n=int(input())

ans=1;
m=10**9+7
if n==1:
  print(0)
else:
  ans1=1;
  ans2=1;
  ans3=1;
  for i in range(n):
    ans1 = (ans1*10)%m
    ans2 = (ans2*9)%m
    ans3 = (ans3*8)%m
   

  ans = (ans1-(2*ans2)+ans3)%m;
  print(ans)

Solution (Python):
n = int(input())
print((10 ** n - 2 * 9 ** n + 8 ** n) % 1000000007)