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
ans = 10**n
ans -= 8**n
ans -= (9**n - 8**n)*2
print(ans % m)

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

a = 10 ** n - 8 ** n

b = 2 * (10 ** n - 9 ** n)

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

Solution (Python):


def solve():
    N = int(input())
    M = 10**9+7
    a = pow(10,N,M)
    b = pow(9,N,M)
    c = pow(8,N,M)
    return str((a-2*b+c)%M)

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

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

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

def njou( x, k ):
    if k == 1:
        return x % mod
    else:
        return njou( x, k - 1 ) * x % mod






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

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

const = 10**9 + 7

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

print(ans)

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

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

max = (10**n)%mod
a = 8**n%mod
b = 9**n%mod
no09 = a
nine_in = (b - a)%mod
zero_in = (b - a)%mod

ans = abs((max - no09 - nine_in - zero_in)%mod)
print(ans)

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

ans1 = 1
ans2 = 1
ans3 = 1
for _ in range(N):
    ans1 = (ans1*10)%MOD
    ans2 = (ans2*9)%MOD
    ans3 = (ans3*8)%MOD

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

Solution (Python):
import math
N=int(input())
MOD = (10**9)+7
a=pow(10,N,MOD)
b=pow(8,N,MOD)
c=pow(9,N,MOD)
d=(c*2)%MOD
if a+b-d<0:
  print((a+b-d+MOD)%MOD)
else:
  print((a+b-d)%MOD)

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

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

Solution (Python):


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

def main():
    n = ni()
    mod = 10**9 + 7
    
    print((pow(10, n, mod) - 2*pow(9, n, mod) + pow(8, n, mod))%mod)

if __name__ == "__main__":
    main()

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

all = 10**N % MOD
none = 8**N % MOD
zero = 9**N % MOD - none
nine = 9**N % MOD - none

ans = (all - none - zero - nine) % MOD
print(ans)

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

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

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

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

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

print(ans)

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

MOD = 1000000007

a = (10 ** N) % MOD - 2 * ((9 ** N) % MOD) + ((8 ** N % MOD))
print(a % MOD)

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

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


no_0 = 9**n


no_9 = 9**n


no_09 = 8**n


yes_09 = 10**n - (no_0+no_9-no_09)

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

Solution (Python):
n = int(input())
val1 = 10
val2 = 9
val3 = 8
if n == 1:
    print(0)
else:
    for i in range(n-1):
        val1 = (val1*10)%(10**9+7)
        val2 = (val2*9)%(10**9+7)
        val3 = (val3*8)%(10**9+7)
    ans = int((val1-2*val2+val3)%(10**9+7))
    if ans<0:
        print(ans+1000000007)
    else:
        print(ans)

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

Solution (Python):
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)




def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res



def Raise(x, y, mod=10**9+7):
    
    n = 0
    while True:
        if (1<<n) > y:
            break
        n+=1
    D = [0]*(n+1)
    x = x % mod
    D[0] = x
    index = 0
    for index in range(1,n):
        D[index] = (D[index-1]**2)
    res = 1
    index = 0
    for index in range(0, n):
        if (y>>index)&1 == 1:
            res *= D[index]
    return res


def main():
    
    n = I()
    res = Raise(10, n)- 2 * Raise(9, n) + Raise(8, n)
    print(res % (10**9+7))
    
if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
def main():
    num = int(input())
    mod = 1000000007
    ans = pow(10, num, mod) - pow(9, num, mod) * 2 + pow(8, num, mod)
    
    
    
    
    
    ans %= mod

    return ans


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

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

a, b = 10, 9
for i in range(N - 1):
    a = (a * 10) % m
    b = (b * 9) % m

A = B = (a - b) % m


a, b = 10, 8
for i in range(N - 1):
    a = (a * 10) % m
    b = (b * 8) % m

C = (a - b) % m

print((A + B - C) % m)

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

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

Solution (Python):
n = int(input())
a = 10**9 +7
b = pow(10,n,a) + pow(8,n,a) - 2 * pow(9,n,a)
if b >= 0:
    print(b)
elif a+b >=0:
    print(a+b)
else:
    print(a+a+b)

Solution (Python):
mod = int(1e9+7)
def pot(a, b):
    result = 1
    while(b):
        if(b%2):
            result=(result*a)%mod
        a=(a*a)%mod
        b//=2
    return result

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

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

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

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

MOD = 10 ** 9 + 7
dp = [[0] * 4 for i in range(n + 1)]
for i in range(1, n + 1):
    if i == 1:
        dp[i][0] = 0
        dp[i][1] = 1
        dp[i][2] = 1
        dp[i][3] = 8
    else:
        dp[i][0] = (dp[i - 1][0] * 10 + dp[i - 1][1] + dp[i - 1][2]) % MOD
        dp[i][1] = (dp[i - 1][1] * 9 + dp[i - 1][3]) % MOD
        dp[i][2] = (dp[i - 1][2] * 9 + dp[i - 1][3]) % MOD
        dp[i][3] = (dp[i - 1][3] * 8) % MOD

print(dp[n][0])

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

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

mod = 10**9+7

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

print((total - rest) % mod)

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

N = int(readline().strip())

p = 10**9 + 7

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

print(ans)

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

K = 10**9+7

def binary(N):
    s = N
    k = int(math.log2(N))
    result = []
    for i in range(k+1,0,-1):
        q = 2**(i-1)
        r = s // q
        result.append(r)
        s -= r*q
        i += 1
    return result

def compute(L, N):
    binary_seq = binary(N)[::-1]
    res = 1
    p = L
    for b in binary_seq:
        if b == 1:
            res = (res * p) % K
        p = p**2 % K
    return res

A= compute(8, N)
B= compute(9, N)
C= compute(10, N)

R = (A+C-2*B) % K
print(R)

Solution (Python):
def LI():
    return list(map(int, input().split()))


N = int(input())
mod = pow(10, 9)+7
if N == 1:
    ans = 0
else:
    total = pow(10, N, mod)
    a = 2*pow(9, N, mod)
    b = pow(8, N, mod)
    ans = (total-a+b) % mod

print(ans)

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

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

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

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

ten = 1
for i in range(n):
    ten *= 10
    ten %= r

nine = 1
for i in range(n):
    nine *= 9
    nine %= r

eight = 1
for i in range(n):
    eight *= 8
    eight %= r

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

Solution (Python):

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


def mod_factorials(n, m):
    mod_factorials = [1] * (n + 1)
    for i in range(1, n+1):
        mod_factorials[i] = mod_factorials[i-1]*i
        mod_factorials[i] %= m
    return mod_factorials


def mod_inv_factorials(n, m):
    mod_invs = [1] * (n + 1)
    invs = [1] * (n + 1)
    for i in range(2, n + 1):
        invs[i] = m - invs[m % i] * (m//i) % m

    for i in range(1, n+1):
        mod_invs[i] = invs[i]*mod_invs[i-1]
        mod_invs[i] %= m
    return mod_invs

if N == 1:
    print(0)
else:
    ans = 0
    pow8 = [1]*(N+1)
    pow2 = [1]*(N+1)
    mod_facts = mod_factorials(N,mod)
    mod_invs = mod_inv_factorials(N,mod)
    for i in range(1,N+1):
        pow8[i] = pow8[i-1]*8
        pow8[i] %= mod
        pow2[i] = pow2[i-1]*2
        pow2[i] %= mod

    for k in range(2,N+1):
        ans += mod_facts[N]*mod_invs[k]*mod_invs[N-k]*(pow2[k]-2)*pow8[N-k]
        ans %= mod
    ans %= mod 


    print(ans)

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

Solution (Python):
mod = 1000000007

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

if __name__ == "__main__":
    solve()

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

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

mod = 10**9+7

niko = 0
zero = 1
kyu = 1
nai = 8


for _ in range(N-1):
    niko = niko*10 + (zero+kyu)
    zero = nai+zero*9
    kyu = nai+kyu*9
    nai *= 8
    
    niko %= mod
    zero %= mod
    kyu %= mod
    nai %= mod
    

print(niko)

Solution (Python):
N = int(input())
S = 0
if N == 1:
  print('0')
else:
  S0 = 10**N - 9**N
  S9 = 10**N - 9**N
  S09 = 8**N
  S = S0 + S9 + S09 - 10**N
  S = S % (10**9 + 7)
  print(S)

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

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

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

print(x)

Solution (Python):
from sys import setrecursionlimit
setrecursionlimit(4100000)


def  mod_pow(a:int, b:int, mod:int)->int:
    if b == 0:
        return 1 % mod
    elif b % 2 == 0:
        return (mod_pow(a, b//2, mod) ** 2) % mod
    elif b == 1:
        return a % mod
    else:
        return ((mod_pow(a, b//2, mod) ** 2) * a) % mod

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

Solution (Python):
import sys
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())

a1 = power_func(10,N,10**9+7)
a2 = power_func(9,N,10**9+7)
a3 = power_func(8,N,10**9+7)
if a1 - 2 * a2 + a3 >= 0:
    print(a1 - 2 * a2 + a3)
    sys.exit()
ans = a1 - 2*a2 + a3
while ans < 0:
    ans += 10**9 + 7
print(ans)

Solution (Python):

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



n = int(input())

mod = 1000000000 + 7

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

Solution (Python):
inf = pow(10,9)+ 7

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

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

mod = 10**9+7

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

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, combinations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from operator import itemgetter
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):
    return fs[n] * invs[n-k] * invs[k] % modp



class UnionFindEx:
    def __init__(self, size):
        
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

from pprint import pprint

def main():
    N=ii()
    if N==1:
        print(0)
        return
    elif N==2:
        print(2)
        return
    ans = 0
    def get(n):
        l = [1]
        for _ in range(N):
            l.append(l[-1] * n % N1097)
        return l
    l8 = get(8)
    l9 = get(9)
    l10 = get(10)

    for i in range(N-1):
        fr = N - i - 1
        a = l8[i] * ((l10[fr] - l9[fr]) % N1097)
        a = (a*2) % N1097
        ans += a
        ans %= N1097
    print(ans)





main()

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

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

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

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

Solution (Python):
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):

    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
x = 10**9+7

a = 1
b = 1
c = 1

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

for i in range(n):
    a *= 10
    a %= x
    b *= 9
    b %= x
    c *= 8
    c %= x

b *= 2
b %= x

b -= c
if b < 0:
    b += x

a -= b
if a < 0:
    a += x

print(a)

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

def comb(n,k):
    if n < k: return 0
    if n < 0 or k < 0: return 0
    return fac[n]*finv[k]%mod*finv[n-k]%mod

fac = [1]*(n+1)
finv = [1]*(n+1)
for i in range(1,n+1):
    fac[i] = fac[i-1]*i%mod
    finv[i] = pow(fac[i],mod-2,mod)

ans = 0
for i in range(2,n+1):
    ans += comb(n,i)*((pow(2,i,mod)-2)%mod)%mod*pow(8,n-i,mod)%mod
    ans %= mod
    
print(ans)

Solution (Python):
N = int(input())
mod = 10**9+7
def power_naive(n, base=8):
  ret = 1
  for _ in range(n):
    ret = (ret*base)%mod

  return ret

ret = 0

if N >= 2:
  ret = power_naive(N, base=10)
  subt = (2*power_naive(N, base=9))%mod
  ret = (ret-subt)%mod
  ret = (ret+power_naive(N, base=8))%mod

print(ret)

Solution (Python):
def getval():
    n = int(input())
    return n 

def main(n):
    mod = 10**9+7
    
    pow8 = [1]
    for i in range(n):
        temp = pow8[i] * 8
        temp %= mod 
        pow8.append(temp)

    
    pow2 = [1]
    for i in range(n):
        temp = pow2[i] * 2
        temp %= mod
        pow2.append(temp)
    for i in range(n+1):
        temp = pow2[i] - 2
        if temp<=0:
            temp = 0
        pow2[i] = temp 

    ans = 0

    lim = n + 1
    fact = [1,1]
    inv = [1,1]
    finv = [1,1]
    for i in range(2,lim+1):
        fact.append((fact[i-1] * i) % mod)
        inv.append(mod - inv[mod%i] * (mod // i) % mod)
        finv.append(finv[i-1] * inv[i] % mod)
    def mod_comb(n,k):
        if n<k:
            return 0
        if n<0 or k<0:
            return 0
        return fact[n] * (finv[k] * finv[n-k] % mod) % mod

    for i in range(n+1):
        temp = pow2[i]*pow8[n-i]*mod_comb(n,i)
        temp %= mod
        ans += temp 
        ans %= mod

    print(ans)

if __name__=="__main__":
    n = getval()
    main(n)

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


MAX = 10**9+7

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

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

    return K * x



if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    res = pow_k(10, N) - 2*pow_k(9, N) + pow_k(8, N) 
    print(res % MAX)

Solution (Python):
n=int(input())
p=10**9+7
def power(a,n,p):
    ret=1
    for _ in range(n):
      ret*=a
      ret%=p
    return ret

print((power(10,n,p)-(2*power(9,n,p))%p+power(8,n,p))%p)

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

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

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

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

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

Solution (Python):
import sys
N = int(input())
if N == 1:
    print(0)
    sys.exit()
alla = 1
for i in range(N):
    alla = (alla * 10) % (10**9+7)
exi1or9 = 1
for i in range(N):
    exi1or9 = (exi1or9 * 9) % (10**9+7)
exi1and9 = 1
for i in range(N):
    exi1and9 = (exi1and9 * 8) % (10**9+7)
ans = (alla-2*exi1or9+exi1and9) % (10**9+7)
print(ans)

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

Solution (Python):
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    if n == 1:
        res = 0
    elif n == 2:
        res = 2
    else:
        res = (10 ** n % MOD - 9 ** n % MOD * 2 + 8 ** n) % MOD
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]

    cout = main(kwargs)
    print(cout)

Solution (Python):
def p(val):
    print(val)


n = int(input())
sho = 10**9+7
vv=0
if n==1:
    vv=0
else:
    vv = ((10**n%sho - 9**n%sho -9**n%sho +8**n%sho)%sho)
p(vv)

Solution (Python):


N = int(input())

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

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

Solution (Python):
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

inf = int(1e10)
mod = int(1e9 + 7)


def solve(N):
    c1 = pow(10, N, mod)
    c2 = (2 * pow(9, N, mod)) % mod
    c3 = pow(8, N, mod)
    ans = (c1 - c2) % mod
    ans = (ans + c3) % mod
    return ans

def main():
    from builtins import int, map
    N = int(input())

    ans = -1
    if N == 1:
        ans = 0
    elif N == 2:
        ans = 2
    else:
        ans = solve(N)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):



import sys

N = int(input())

MOD = (10 ** 9) + 7

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

print(ans)

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

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

Solution (Python):
N = int(input())
MOD = 1_000_000_007
A = pow(10, N, MOD) - pow(9, N, MOD)
AorB = pow(10, N, MOD) - pow(8, N, MOD)
print( (A * 2  - AorB) % MOD if N > 1 else 0)

Solution (Python):
N=int(input())
inf=10**9+7
ans=0
if N==1:
    print(0)
else:
    temp1=1
    temp2=1
    temp3=1
    for i in range(N):
        temp1*=10
        temp2*=8
        temp3*=9
        temp1%=inf
        temp2%=inf
        temp3%=inf
    ans=temp1+temp2-2*temp3
    ans%=inf
    print(ans)

Solution (Python):
N = int(input())
ans = N*(N-1)
mod = 10**9 + 7
ans %= mod
ans = 1
A = 1
B = 1
C = 1
for i in range(N):
    A *= 10
    B *= 9
    C *= 8
    A %= mod
    B %= mod
    C %= mod

print((A-B*2+C) % mod)

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

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

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

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

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

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

Solution (Python):
N=int(input())
P=10**9+7
s_10=1
for i in range(N):
  s_10=(s_10*10)%P
s_9=1
for i in range(N):
  s_9=(s_9*9)%P
s_9=(s_9*2)%P
s_8=1
for i in range(N):
  s_8=(s_8*8)%P
print ((s_10-s_9+s_8)%P)

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

if N == 1:
    print(0)
else:
    a = (10**N) % (10**9+7)
    b = (2*(9**N)) % (10**9+7)
    c = (8**N) % (10**9+7)
    print((a-b+c)%(10**9+7))

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

N = int(readline())

DIV = 10 ** 9 + 7



dp = [[[0] * 2 for j in range(2)] for i in range(N + 1)]

dp[0][0][0] = 1

for i in range(1, N + 1):
  dp[i][0][0] += dp[i - 1][0][0] * 8 
  dp[i][0][0] %= DIV
  
  dp[i][1][0] += dp[i - 1][0][0] 
  dp[i][1][0] += dp[i - 1][1][0] * 9 
  dp[i][1][0] %= DIV
  
  dp[i][0][1] += dp[i - 1][0][0] 
  dp[i][0][1] += dp[i - 1][0][1] * 9 
  dp[i][0][1] %= DIV
  
  dp[i][1][1] += dp[i - 1][1][0] 
  dp[i][1][1] += dp[i - 1][0][1] 
  dp[i][1][1] += dp[i - 1][1][1] * 10 
  dp[i][1][1] %= DIV
  
print(dp[-1][1][1])

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

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

print(int(ans))

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


def pow_mod(a, b):
    if b <= 0:
        return 1
    elif b % 2 == 0:
        d = pow_mod(a, b // 2)
        return d ** 2 % MOD
    else:
        return a * pow_mod(a, b - 1) % MOD


ans = pow_mod(10, N) - pow_mod(9, N) * 2 + pow_mod(8, N)
if ans < 0:
    ans += MOD * 2
print(ans % MOD)

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

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

mod = 10**9 + 7
TEN = 1
EIGHT = 1
NINE = 1
for n in range(N):
    TEN *= 10
    EIGHT *= 8
    NINE *= 9
    TEN %= mod
    EIGHT %= mod
    NINE %= mod
print((TEN - NINE*2 + EIGHT)%mod)

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

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

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

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

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

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

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

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

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

Solution (Python):
n = 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
if n == 1:
    print(0)
else:
    mod = 10**9+7
    print((power_func(10, n, mod)-(power_func(9, n, mod)*2-power_func(8, n, mod)))%mod)

Solution (Python):

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


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

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

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

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


a = 10 ** n

b = 9 ** n

c = 9 ** n

d = 8 ** n

ans = a - b - c + d

print(ans % 1000000007)

Solution (Python):
n = int(input())
mod = 10**9+7
dp = [[0]*4 for _ in range(n)]
dp[0] = [8,1,1,0]
for i in range(1,n):
    dp[i][0] = (dp[i-1][0]*8)%mod
    dp[i][1] = (dp[i-1][0] + dp[i-1][1]*9)%mod
    dp[i][2] = (dp[i-1][0] + dp[i-1][2]*9)%mod
    dp[i][3] = (dp[i-1][1] + dp[i-1][2] + dp[i-1][3]*10)%mod
print(dp[-1][-1])

Solution (Python):
a=int(input())
n1=10**a
n2=9**a
n3=8**a
x=n1-n2
y=n1-n3
z=x*2-y
print(z%(10**9+7))

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

Solution (Python):

import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    mod = 10 ** 9 + 7
    if n == 1:
        print(0)
    elif n == 2:
        print(2)
    else:
        print((pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod)) % mod)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
if n<2:
    print(0)
    exit()
k=2
mod=10**9+7
framod=[1]
def framod_calc(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
        framod.append(a)

def permmod(n, k, mod):
    if n<k: return 0
    a=framod[n]
    c=framod[n-k]
    return (a * pow(c, mod-2, mod)) % mod

def combmod(n, k, mod):
    if n<k: return 0
    a=framod[n]
    b=framod[k]
    c=framod[n-k]
    return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod

framod_calc(n+1, mod)
ans=0

for i in range(2, n+1):
    ans+=(combmod(n,i,mod)*(pow(2, i, mod)-2))*pow(8, n-i, mod)
    ans%=mod

print(ans)

Solution (Python):
def main():
    N = int(input())
    mod = 10 ** 9 + 7
    mod_1 = 1
    mod_2 = 1
    mod_3 = 1
    for _ in range(N):
        mod_1 = (mod_1 * 10) % mod
        mod_2 = (mod_2 * 9) % mod
        mod_3 = (mod_3 * 8) % mod
    v = mod_1 - 2 * mod_2 + mod_3
    if v < 0:
        v *= -1
        v = ((v // mod) + 1) * mod - v
    print(v)

if __name__ == '__main__':
    main()

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

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

print(ans)

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    n = II()
    print((pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod)) % mod)
    return



if __name__ == '__main__':
    solve()

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

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

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

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

Solution (Python):
n = int(input())
MAX = 1000100
MOD = 10**9 + 7
modPow8 = [1] * MAX
modPow2 = [1] * MAX
for i in range(1, MAX):
    modPow2[i] = modPow2[i-1] * 2 % MOD
    modPow8[i] = modPow8[i-1] * 8 % MOD
fact = [1] * MAX
inv = [1] * MAX
fact_inv = [1] * MAX 
for i in range(2, 1000100):
    fact[i] = fact[i-1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    fact_inv[i] = fact_inv[i-1] * inv[i] % MOD
def comb(n, k):
    return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD
ans = 0
for k in range(2, n+1):
    ans += comb(n, k) * (modPow2[k] - 2) * modPow8[n-k]
    ans %= MOD
print(ans)

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

dp=[[0,0,0,0] for _ in range(n)]

dp[0]=[8,1,1,0]

for i in range(1,n):
    dp[i][0]=(dp[i-1][0]*8)%mod
    dp[i][1]=(dp[i-1][0]+dp[i-1][1]*9)%mod
    dp[i][2]=(dp[i-1][0]+dp[i-1][2]*9)%mod
    dp[i][3]=(dp[i-1][1]+dp[i-1][2]+dp[i-1][3]*10)%mod



print(dp[-1][3]%mod)

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

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

mod = 1000000007

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

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