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())
M=10**9+7
A=pow(9,N,M)
B=pow(9,N,M)
C=pow(8,N,M)
A-=C
B-=C
S=pow(10,N,M)
ans=S-C-(A+B)
print(ans%M)

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

def for_factorial(n):
    val = 1
    for i in range(2, n + 1):
        val *= i
        val = val%MOD
    return val

def for_ten(n):
  val = 1
  for i in range(n):
    val *= 10
    val = val%MOD
  return val

def for_nine(n):
  val = 1
  for i in range(n):
    val *= 9
    val = val%MOD
  return val

def for_eight(n):
  val = 1
  for i in range(n):
    val *= 8
    val = val%MOD
  return val

answer = (-2*for_nine(N)+for_eight(N)+for_ten(N))%MOD
print(answer)

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

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

Solution (Python):
def calculate(n):
    mod = 1000000000 + 7

    result = pow(10, n, mod)

    
    
    s1 = pow(9, n, mod) - pow(8, n, mod)

    
    
    s2 = pow(9, n, mod) - pow(8, n, mod)

    
    
    s3 = pow(8, n, mod)

    result = result - (s1 + s2 + s3)

    print(result % mod)


calculate(int(input()))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

mod = 10**9+7
n = int(readline())
a = 10 ** n % mod
b = 9 ** n % mod
c = 8 ** n % mod

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

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

    MOD = 10 ** 9 + 7

    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]


    def cmb(n, k, p):
        if (k < 0) or (n < k):
            return 0
        r = min(k, n - k)
        return fact[n] * factinv[k] * factinv[n - k] % p


    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)


    ans = pow(10, N, MOD)
    ans -= pow(8, N, MOD)
    ans %= MOD
    for i in range(1, N + 1):
        ans -= pow(8, N - i, MOD) * cmb(N, i, MOD) * 2
        ans %= MOD
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()

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

bunbo = (10 ** n) - 2 * (9 ** n) + (8 ** n)
bunsi = 10 ** 9 + 7

print(bunbo % bunsi)

Solution (Python):
import numpy as np
from numba import njit

MOD = 10**9 + 7

@njit
def f(N):
  
  dp = np.zeros((N+1, 2, 2), np.int64)
  dp[0,0,0] = 1
  for n in range(N):
    
    dp[n+1,0,0] += 8 * dp[n,0,0]  
    dp[n+1,0,1] += dp[n,0,0]  
    dp[n+1,1,0] += dp[n,0,0]  
    
    
    dp[n+1,0,1] += 9 * dp[n,0,1]  
    dp[n+1,1,1] += dp[n,0,1]  
    
    
    dp[n+1,1,0] += 9 * dp[n,1,0]  
    dp[n+1,1,1] += dp[n,1,0]  
    
    
    dp[n+1,1,1] += 10 * dp[n,1,1]
    
    dp[n+1] %= MOD
  return dp[N,1,1]
         
N = int(input())
print(f(N))

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

def cmb(n, r, p):
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

def pow(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

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, 10**6 + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    ans = 0
    powered_2 = pow(2, 1, p)
    for i in range(2, n + 1):
        powered_2 = powered_2 * 2 % p
        tryvalue = ((powered_2 - 2)*cmb(n, i, p)*pow(8, n-i, p))
        ans = (ans + tryvalue) % p
    print(ans)

Solution (Python):

N = int(input())
total = 10 ** N
no_9 = 9 ** N
no_0 = 9 ** N
no_0and9 = 8 ** N
print((total - (no_9 - no_0and9) - (no_0 - no_0and9) - no_0and9)%(10**9 + 7))

Solution (Python):
import sys
sys.setrecursionlimit(10000000)

mod = 10 ** 9 + 7
def pow(a, n):
    if n == 0:
        return 1
    if n == 1:
        return a
    tmp = pow(a, n//2)
    tmp = (tmp * tmp) % mod
    if n % 2 == 1:
        tmp = (tmp * a) % mod
    return tmp

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

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

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

d_num = (10 ** 9) + 7

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

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

def mod_k_n(k,n,default):
    r = []
    j = k
    while n > 1:
        if n % 2 == 1:
            r.append(j)
            n -= 1
        j = (j ** 2) % (10 ** 9 + 7)
        n = n // 2
    else:
        r.append(j)
        for s in r:
            default = (default * s) % (10 ** 9 + 7)
    return default
if n == 1:
  print(0)
else:
  ans = mod_k_n(10,n,1) - mod_k_n(9,n,2) + mod_k_n(8,n,1) + (10 ** 9 + 7)
  print(ans%(10 ** 9 + 7))

Solution (Python):
N = int(input())
MOD = 10**9+7
ans = 1
for i in range(N):
  ans*=10
  ans%=MOD
sub = 2
for i in range(N):
  sub*=9
  sub%=MOD
sub2 = 1
for i in range(N):
  sub2*=8
  sub2%=MOD
print((ans-(sub-sub2))%MOD)

Solution (Python):
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
  
n = int(input())
x = power_func(10, n, (10**9 + 7))
y = power_func(8, n, (10**9 + 7))
z = power_func(9, n, (10**9 + 7))
print((x + y - 2 * z) % (10**9 + 7))

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

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


x = 10 ** a 
y = 9 ** a
z = 9 ** a
q = 8 ** a

ans = ( x - y - z + q ) % (10 ** 9 + 7 )

print(ans)

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

Solution (Python):
import math
def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n = n >> 1
    return res


n = int(input())

if n == 1:
    print(0)
else:
    r = modpow(10, n, 1000000007) - 2 * modpow(9, n, 1000000007) + modpow(8, n, 1000000007)
    print(r % 1000000007)

Solution (Python):
import sys
N= int(input())
if N==1:
    print(0)
    sys.exit()
if N>=2:
    a=10
    b=9
    c=8
    for i in range(N-1):
        a=a*10
        b=b*9
        c=c*8
        if a>(10**9+7):
            if b>(10**9+7):
                if c>(10**9+7):
                    a=a%(10**9+7)
                    b=b%(10**9+7)
                    c=c%(10**9+7)
s=(a-2*b+c)%(10**9+7)
print(s)

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

n = int(input())

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

if n == 2:
    print(2)
    exit()

print((pow(10, n, MOD) - 2 * pow(9, n, MOD) + pow(8, n, MOD)) % MOD)

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

Solution (Python):
def solve(x):
    return 10 ** x - 9 ** x - 9 ** x + 8 ** x


n = int(input())
if n == 1:
    print(0)
    exit()
elif n == 2:
    print(2)
    exit()

print(solve(n) % (10 ** 9 + 7))

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

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

d = 1000000007
result = int(10 ** N) % d
result -= int(9 ** N) % d
result = result % d
result *= 2
result = result % d
result -= int(10 ** N) % d
result += int(8 ** N) % d

result = result if result >= 0 else d + result
print(result)

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

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

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

Solution (Python):

MOD = 10**9 + 7
def mpow(b,n):
    

    
    
    ans = 1
    while n> 0:
        if n&1:
            ans = ans * b
            ans%= MOD
        b = b * b
        b%=MOD
        n>>=1 
    return ans



n = int(input())

ans = mpow(10,n)
ans = ans - 2*(mpow(9,n))
if ans < 0:
    ans+=MOD
ans = ans+ mpow(8,n)
ans = ans%MOD

print(ans)

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

k=1
mod=10**9+7
for i in range(n):
    k*=10
    k%=mod
l=1
m=1
for i in range(n):
    l*=9
    l%=mod
for i in range(n):
    m*=8
    m%=mod
a=k+m
a-=2*l
a%=mod
print(a)

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

Solution (Python):
import math
NN = int(input())

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


a = power_func(10, NN , 10 ** 9 + 7)
b = power_func(9 , NN , 10 ** 9 + 7)
c = power_func(8 , NN , 10 ** 9 + 7)

x = ((a - b - b + c) + 10 ** 9 + 7 + 10 ** 9 + 7 ) % (10 ** 9 + 7)
print(x)

Solution (Python):
import math
def solve():
	ret = 0
	n = int(input())
	val = 10**n-8**n
	val2= 10**n-9**n
	ret = val-(val-val2)*2
	

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

solve()

Solution (Python):





def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

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

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

def print_space(l):
    return print(" ".join([str(x) for x in l]))


import numpy as np
import collections as col

N = int(input())

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

Solution (Python):
N=int(input())
if N==1:
    print(0)
    exit(0)

MOD=10**9+7

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

b*=2%MOD
if a+b-c>=0:
    print((a-b+c)%MOD)
else:
    print((a-b+c+MOD)%MOD)

Solution (Python):
n = int(input())
if n ==1:
  print(0)
  exit()
  
mod = 10**9 + 7  
c = 10**n + 8**n
d = 9**n + 9**n
print((c-d)%mod)

Solution (Python):
n = int(input())
if n == 1:
    print(0)
    exit()
ans1 = 1
ans2 = 1
ans3 = 1
for i in range(n):
    ans1 = (ans1*10)%1000000007
    ans2 = (ans2*9)%1000000007
    ans3 = (ans3*8)%1000000007

ans = (ans1 - ans2*2 + ans3)%1000000007

print(ans)

Solution (Python):
import math
N = int(input())
if N == 1:
    print(0)
    exit()

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

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

Solution (Python):
N = int(input())
mod = 10 ** 9 + 7
A = pow(10, N, mod)
B = pow(9, N, mod)
C = pow(8, N, mod)
A = A - (2 * B - C)
A %= mod
if A < 0:
  A = A + mod
print(A)

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

    all = 10 ** N
    n9 = 9 ** N
    n0 = 9 ** N
    n0_9 = 8 ** N

    tmp_ans = all -(n9 + n0 - n0_9)

    ans = tmp_ans % ((10**9) + 7)

    print(ans)

if __name__ == "__main__":
    solve()

Solution (Python):
n = int(input())
ans = pow(10,n,1000000000+7)
x = pow(8,n,1000000000+7)
y = pow(9,n,1000000000+7)

ans = ans + x - 2*y
print(ans%(1000000000+7))

Solution (Python):
def div(n,T):
    tmp = 10 ** 9 + 7
    _ = 1
    for t in range( T- 1):
        _ *= n
        _ %= tmp
    return _ * n
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)
print((a + c - b * 2) % (10 ** 9 + 7))

Solution (Python):
if __name__ == "__main__":
    a = input()
    a = int(a)
    
    not_0and9 = 8**a
    
    not_0 = 9**a
    
    not_9 = 9**a
    
    not_n = not_0 + not_9 - not_0and9
    n = 10**a - not_n
    print(n%(10**9+7))

Solution (Python):
n=int(input())
ans=1
sub=1
sub2=1
for i in range(n):
    ans*=10
    ans%=(10**9+7)
    sub*=9
    sub%=(10**9+7)
    sub2*=8
    sub2%=(10**9+7)
ans-=2*sub-sub2
print(ans%(10**9+7))

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

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

MOD = 1000000007

a  = 10**N-2*9**N+8**N

a = a % MOD

print(a)

Solution (Python):
n = int(input())
mod = pow(10, 9)+7
ans1 = 1
ans2 = 1
ans3 = 1
for i in range(n):
    ans1 = (ans1*10)%mod
    ans2 = (ans2*8)%mod
    ans3 = (ans3*9)%mod
print((ans1+ans2-ans3*2)%mod)

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

if N == 1:
  print(0)
else:
  ALL = 10**N % (10**9 + 7)
  t = 2 * 9**N % (10**9 + 7)
  s = 8**N % (10**9 + 7)
  print((ALL - (t - s)) % (10**9 + 7))

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

if n > 1:
    cnt = 10**n-2*9**n+8**n
    cst = 10**9+7
    print (cnt%cst)
else:
    print (0)

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

def modpow(x, n):
    res = 1
    while n > 0:
        if n & 1 == 1:
            res = res*x%mod
        x = x*x%mod
        n >>= 1
    return res

N = int(input())
ans = (modpow(10,N)-2*modpow(9,N)+modpow(8,N))%mod

print(ans)

Solution (Python):

import sys

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

def solve(N: int):
    if N==1:
        print(0)
    elif N==2:
        print(2)
    else :
        tmp=(power_func(10,N,MOD))+(power_func(8,N,MOD))
        tmp=tmp%MOD
        tmp2=(2*power_func(9,N,MOD))%MOD
        if tmp-tmp2<0:
            print(tmp-tmp2+MOD)
        else :
            print(tmp-tmp2)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = 1
b = 1
c = 1
for i in range(N):
  a = (a * 10) % (10 ** 9 + 7)
  b = (b * 9) % (10 ** 9 + 7)
  c = (c * 8) % (10 ** 9 + 7)
d = a - 2 * b + c
while d < 0:
  d += 10 ** 9 + 7
print(d)

Solution (Python):
N = int(input())
mod_num =int(1.0e+9+7)

all_num = pow(10,N,mod=mod_num)
not09_num = pow(9,N,mod=mod_num)
both09_num = pow(8,N,mod=mod_num)
print((all_num-not09_num*2+both09_num)%mod_num)

Solution (Python):
n=int(input())
mod=10**9+7
ans=0
temp1=1
temp2=1
temp3=pow(2,n,mod)
for i in range(n-1):
    ans+=(((temp1*temp2)%mod)*(temp3%mod-2))%mod
    temp1=((temp1*(n-i))*pow(i+1,mod-2,mod))%mod
    temp2=(temp2*8)%mod
    temp3=pow(2,n-i-1,mod)
    

print(ans%mod)

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



print(int((10**N-(2*9**N-8**N))%waru))

Solution (Python):
import sys
N=int(sys.stdin.readline().strip())
mod=10**9+7
print (pow(10,N,mod)-(pow(9,N,mod)*2-pow(8,N,mod)))%mod

Solution (Python):
MOD = 1000000007
def modpow(a, n, mod) :
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % mod        
        a = a * a % mod
        n = n // 2
    return ret

N = int(input())

ret1 = modpow(10,N,MOD) 
ret2 = modpow(8,N,MOD)
ret3 = modpow(9,N,MOD)
ret = (ret1 - ret3 - ret3 + ret2) % MOD
print(ret)

Solution (Python):
def main():
  n = int(input())
  
  if n == 1: return 0
  if n == 2: return 2
  
  mod = 10**9 + 7

  n_10 = pow(10, n, mod)
  n_9 = pow(9, n, mod)
  n_8 = pow(8, n , mod)
  
  ans = (n_10 - 2*n_9 + n_8) % mod
  
  return ans
  
  
ans = main()
print(ans)

Solution (Python):
import numpy as np

def solve(num, div):
    if num < 2:
        return 0
    if num == 2:
        return 2
    ans = 10 ** num - 2 * 9 ** num + 8 ** num
    return ans % div

num = int(input())
div = 10 ** 9 + 7
print(solve(num, div))

Solution (Python):
def pow_k(x, n,mod = 10**9+7):
    x %= mod
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K %= mod
        x *= x
        x %= mod
        n //= 2

    return K * x % mod

def solve(n,mod = 10**9+7):
    total = pow_k(10,n)
    not_include_0 = pow_k(9,n)
    not_include_9 = not_include_0
    not_include_0_and_9 = pow_k(8,n)
    return (total%mod-(not_include_0 + not_include_9 - not_include_0_and_9)%mod)%mod

def main():
    n = int(input())
    print(solve(n))

if __name__ == '__main__':
    main()

Solution (Python):
mod = 1000000007

N = int(input())

A = 1
B = 1
C = 1
ans = 0

for _ in range(1,N+1):
  A *= 10
  A %= mod
  B *= 9
  B %= mod
  C *= 8
  C %= mod
  ans = A - (2*B - C)
  if ans < 0: ans += mod

if ans < 0: ans += mod

print(ans)

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





  


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

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

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

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

N = int(input())
x = 10**N + 8**N - 2*9**N
print(x%MOD)

Solution (Python):
n = int(input())
p = 10**9 + 7
dp=[[0]*(2) for i in range(2)]
dp[0][0]=1

for i in range(n):
  nextDP = [[0]*(2) for i in range(2)]
  nextDP[1][1] += (dp[0][1] + dp[1][0] + dp[1][1] * 10) % p
  nextDP[1][0] += (dp[1][0] * 9 + dp[0][0]) % p
  nextDP[0][1] += (dp[0][1] * 9 + dp[0][0]) % p
  nextDP[0][0] += (dp[0][0] * 8) % p
  dp = nextDP
print(dp[1][1] % p)

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



  
if n == 1:
	ans = 0
else:
	cala = 10 ** n % MOD
	calb = 9 ** n % MOD
	calc = 8 ** n % MOD
	ans = (cala - calb*2 + calc) % MOD

     
print(ans)

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

ans = pow(10, N, M)
ans = ans + M - pow(9, N, M)
ans = ans + M - pow(9, N, M)
ans = ans + pow(8, N, M)
ans = ans % M
print(ans)

Solution (Python):
from scipy.special import comb
def main():
    n = int(input())
    
    
    
    
    
    ans = 10**n - 2*(9**n) + 8**n
    print(int(ans%((10)**9+7)))
if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
N = int(input())
DP = [[0]*4 for _ in range(N)]
MOD = 10**9+7
for i in range(N):
    if i == 0:
        DP[i][0] = 8
        DP[i][1] = 1
        DP[i][2] = 1
        DP[i][3] = 0
        continue
    DP[i][0] = (DP[i-1][0] * 8) % MOD
    DP[i][1] = (DP[i-1][1] * 9) %MOD + (DP[i-1][0]) % MOD
    DP[i][2] = (DP[i-1][2] * 9) % MOD + ( DP[i-1][0]) % MOD
    DP[i][3] = (DP[i-1][3] * 10)% MOD + DP[i-1][1] % MOD+ DP[i-1][2] % MOD

print(DP[-1][3]%MOD)

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

Solution (Python):
n=int(input())
mod=(1e+9)+7
x=1
if n>=2:
  ans=1
else:
  ans=0
for i in range(n):
  x*=10
  ans*=8
  ans%=mod
  x%=mod
nin=1

for i in range(n):
  nin*=9
  nin%=mod
x+=ans
x%=mod
x-=(nin*2)%mod
if x<0:
  x+=mod
if n==1:
  print(0)
else:
  print(int(x%mod))

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

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

q = int(1e9+7)

print((pow(10, N, q) - 2 * pow(9, N, q) + pow(8, N, q)) % q)

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

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

Solution (Python):
N = int(input())
a = 10**9 + 7
tmp1 = 10**N %a

tmp2 = 2*9**N  %a

tmp3 = 8**N  %a


answer = (tmp1-tmp2+tmp3) %a

print(answer)

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

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

if N == 0 or N == 1:
    print(0)

else:
    
    dp = [0] * (N + 1)

    
    exp_9 = [0] * (N + 1)
    exp_9[0] = 1
    for i in range(1, N + 1):
        exp_9[i] = (exp_9[i - 1] * 9) % mod

    
    exp_8 = [0] * (N + 1)
    exp_8[0] = 1
    for i in range(1, N + 1):
        exp_8[i] = (exp_8[i - 1] * 8) % mod

    
    for i in range(2, N + 1):
        dp[i] = (dp[i - 2] * 100 + 38 * exp_9[i - 2] - 36 * exp_8[i - 2]) % mod
        

    print(dp[N])

Solution (Python):
"""
int(input())
map(int, input().split())
list(map(int, input().split()))
input()
input().split()
"""


n = int(input())
mod = 1000000007

tmp = 1
diff = 1
eight = 1

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

ans = tmp - 2*diff + eight
ans %= mod
print(ans)

Solution (Python):
n = int(input())
mod = 10**9 + 7
ans = 1
for _ in range(n):
    ans *= 10
    ans %= mod

no1 = 1
no19 = 1
for _ in range(n):
    no1 *= 9
    no1 %= mod
for _ in range(n):
    no19 *= 8
    no19 %= mod
print((ans -(no1*2 - no19))%mod)

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

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

print (ans)

Solution (Python):
def main():
    N = int(input())
    m = 10 ** 9 + 7
    ans = pow(10, N, m) - 2 * pow(9, N, m) + pow(8, N, m)
    ans = ans % m
    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
mod = 10**9 + 7
a = 10**n % mod
b = 9**n % mod
c = 8**n % mod
ans = a + c - 2*b
if ans >= 0:
    ans = ans % mod
else:
    ans += 2*mod
    ans = ans % mod
    
print(ans)

Solution (Python):
def powmod(a, n, p):
    if(n==0):
        return 2
    elif(n==1):
        return a%p
    elif(n%2==1):
        return ((a%p)*(powmod(a,n//2,p)**2%p))%p
    elif(n%2==0):
        return powmod(a,n//2,p)**2%p
N=int(input())
p=10**9+7
if(N==1):
    print(0)
else:
    print((powmod(10,N,p)-2*powmod(9,N,p)+powmod(8,N,p))%p)

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

Solution (Python):
n=int(input())
ant,bnt,cnt=1,1,1

for i in range(n) :
    ant=10*ant%1000000007
    bnt=9*bnt%1000000007
    cnt=8*cnt%1000000007

ans=(ant-(bnt*2-cnt))%1000000007

if ans>=0 :
    print(ans)
else :
    print(1000000007+ans)

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

Solution (Python):
N=int(input())
a=1
b=1
c=1

for i in range(N):
    a=(a*10)%(10**9+7)
for j in range(N):
    b=(b*8)%(10**9+7)
for k in range(N):
    c=(c*9)%(10**9+7)

ans=(a+b-2*c)%(10**9+7)

print(ans)

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())

p = 10**9+7


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

_09 = pow(10,n,p)
_19 = _08 = pow(9,n,p)
_18 =  pow(8,n,p)

print((_09-_19*2+_18)%p)

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

if N == 1:
  print('0')
  exit()

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

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

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

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

n1 = (10**n) % x
n2 = (9**n) % x
n3 = (8**n) % x
ans = (n1 - n2 *2 + n3) % x

print(ans)

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

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

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

Solution (Python):
MOD = 1000000007
class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )
      
n = int(input())
a = ModInt(1)
b = ModInt(1)
w = ModInt(1)
for i in range(n):
  a *= 9
  b *= 8
  w *= 10
  
ex = a * 2 - b
ans = w - ex
print(ans)

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

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

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

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

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

nab = (10**n)-(8**n)
na = (10**n)-(9**n)
ans = na*2-nab

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

Solution (Python):
from itertools import combinations 
n=int(input())
waru=10**9+7
num_all=(10**n)%waru
num_0_9=(9**n)%waru
num_no=(8**n)%waru
print((num_all-num_0_9*2+num_no+waru)%waru)

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

a = 10**n % (10**9+7)
b = 8**n % (10**9+7)
c = 9**n % (10**9+7)

x = b + a - 2*c

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

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

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

ans = 0
count9 = 1
count0 = 1
other = 8
for i in range(n-1):
  ans = ans*10 + count9+count0
  count9 = count9*9 + other
  count0 = count0*9 + other
  other *= 8
  
  count9 %= MOD
  count0 %= MOD
  ans %= MOD
  other %= MOD
  
print(ans%MOD)

Solution (Python):

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

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

  print(int(res))

Solution (Python):
def main():
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    N=int(input())
    mod0=1000000007

    print((10**N-2*9**N+8**N)%mod0)

   




if __name__ == '__main__':
    main()

Solution (Python):
a = 1000000007
 
n = int(input())
 
not0 = 1
not0and9 = 1
all = 1
for i in range(n):
  not0and9 = (not0and9 * 8) % a
  not0 = (not0 * 9) % a
  all = (all * 10) % a;
  
print((all + not0and9 - 2 * not0) % a)

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

if N == 1:
    print(0)
    
else:
    s=10**N + 8**N - 2*(9**N)
    print(s%1000000007)

Solution (Python):
from sys import stdin
input = stdin.readline

N = int(input())

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

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

print(ans % mod)

Solution (Python):



def main():
    stdIn = int(input())
    stdOut = solve(stdIn)
    print(stdOut)


"""
方針
パターン数としては
(0を少なくとも一つ含む場合 + 9を少なくとも一つ含む場合 - 0,9どちらか一つを含む場合)
= (10^n - 9^n) * 2 - (10^n - 8^n)
10^n + 8^n - 2 * 9^n
正しn<=10^6なので単純に計算するとオーバーフローする
逐次計算して10^9+7を超えたら減らす方針にする

"""

mod = 1000000007


def solve(n):
    
    n10 = modpow(10, n, mod)
    n8 = modpow(8, n, mod)
    n9 = modpow(9, n, mod)
    s = n10 + n8 - n9 * 2
    while s < 0:
        s += mod
    return s




def modpow(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 __name__ == "__main__":
    main()

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

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

def modpow(a,n):
    r=1
    while n > 0:
        if n%2==1:
            r = r*a%MOD
        a = a*a % MOD
        n = n//2
    return r

N=int(input())
a10N=modpow(10,N)
a9N=modpow(9,N)
a8N=modpow(8,N)
ans=a10N-(a8N+2*(a9N-a8N))
ans%=MOD
print(ans)

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

MOD = 1_000_000_007
a, b, c, d = 8, 1, 1, 0
for i in range(N - 1):
    a, b, c, d = 8 * a, a + 9 * b, a + 9 * c, b + c + 10 * d
    a %= MOD
    b %= MOD
    c %= MOD
    d %= MOD
print(d)

Solution (Python):
def fast_pow(x, n, MOD):
    res = 1
    while n:
        if n & 1:
            res = res * x % MOD
        x = x * x % MOD
        n >>= 1
    return res
  

MOD = 10**9+7

n = int(input())

a = fast_pow(10, n, MOD)
b = fast_pow(8, n, MOD)
c = fast_pow(9, n, MOD)
print((a - 2*c + b)% MOD)

Solution (Python):

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

def fun (x):
  return (x if x >= 0 else x + mod)

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

print(ans)

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

mod = 10**9 + 7
a = (10**n) % mod
b = (9**n) % mod
c = (8**n) % mod

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

Solution (Python):
def power(a, e, m):
  s = 1
  while e>0:
    if e % 2 == 1:
      s = s * a % m
    a = a * a % m
    e = int(e / 2 % m)
  return s

n = int(input())
print((power(10, n, 1000000007) + power(8, n, 1000000007) - power(9, n, 1000000007)*2) % 1000000007)

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

Solution (Python):

import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter

from functools import lru_cache
import copy


input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7




def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])





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