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

Solution (Python):
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N = INT()

dp = list2d(3, N+1, 0)
dp[0][0] = 1
for i in range(N):
    dp[0][i+1] += dp[0][i] * 8
    dp[1][i+1] += dp[0][i] * 2
    dp[1][i+1] += dp[1][i] * 9
    dp[2][i+1] += dp[1][i]
    dp[2][i+1] += dp[2][i] * 10
    dp[0][i+1] %= MOD
    dp[1][i+1] %= MOD
    dp[2][i+1] %= MOD
ans = dp[2][N]
print(ans)

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

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

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



ans1 = 1
ans2 = 1
ans3 = 1
b=10**9+7
for i in range(N):
    ans1 *= 10
    ans1 %= b
    ans2 *= 9
    ans2 %= b
    ans3 *= 8
    ans3 %= b

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

print(ans)

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

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

a = 1
b = 1
c = 1

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

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

print(ans)

Solution (Python):
n=int(input())
mod=10**9+7
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
def power(x, y, p) : 
    res = 1     
  
    
    
    x = x % p  
      
    if (x == 0) : 
        return 0
  
    while (y > 0) : 
          
        
        
        if ((y & 1) == 1) : 
            res = (res * x) % p 
  
        
        y = y >> 1      
        x = (x * x) % p 
          
    return res 
a = pow(10,N,MOD)
b = pow(9,N,MOD)
c = pow(8,N,MOD)
print((a-2*b+c)%MOD)

Solution (Python):

"""
Created on Sun Sep 13 21:12:17 2020

@author: liang
"""

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

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

Solution (Python):

import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys


readline = sys.stdin.readline

INF = 1 << 60


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
def slv(N):
    M = Mod(10**9 + 7)
    ans = M.pow(10, N)
    ans = M.sub(ans, M.pow(9, N))
    ans = M.sub(ans, M.pow(9, N))
    ans = M.add(ans, M.pow(8, N))


    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Solution (Python):


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

tot = 10**n

inc0 = (tot - 9**n)%mod
inc9 = (tot - 9**n)%mod
inc0or9 = (tot - 8**n)%mod

ans = (inc0+inc9-inc0or9)%mod
print(ans)

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

Solution (Python):
def ii(): return int(input())


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


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


MOD = 10**9 + 7


class ModInt:

    def __init__(self, x):
        self.x = x.x if isinstance(x, ModInt) else x % MOD

    def __str__(self): return str(self.x)
    __repr__ = __str__
    def __int__(self): return self.x
    __index__ = __int__

    def __add__(self, other): return ModInt(self.x + ModInt(other).x)
    def __sub__(self, other): return ModInt(self.x - ModInt(other).x)
    def __mul__(self, other): return ModInt(self.x * ModInt(other).x)
    def __pow__(self, other): return ModInt(pow(self.x, ModInt(other).x, MOD))
    def __truediv__(self, other): return ModInt(
        self.x * pow(ModInt(other).x, MOD - 2, MOD))

    def __floordiv__(self, other): return ModInt(self.x // ModInt(other).x)
    def __radd__(self, other): return ModInt(other + self.x)
    def __rsub__(self, other): return ModInt(other - self.x)
    def __rpow__(self, other): return ModInt(pow(other, self.x, MOD))
    def __rmul__(self, other): return ModInt(other * self.x)
    def __rtruediv__(self, other): return ModInt(
        other * pow(self.x, MOD - 2, MOD))

    def __rfloordiv__(self, other): return ModInt(other // self.x)

    def __lt__(self, other): return self.x < ModInt(other).x
    def __gt__(self, other): return self.x > ModInt(other).x
    def __le__(self, other): return self.x <= ModInt(other).x
    def __ge__(self, other): return self.x >= ModInt(other).x
    def __eq__(self, other): return self.x == ModInt(other).x
    def __ne__(self, other): return self.x != ModInt(other).x


def cmb(n, r):  
    retVal = 1
    for i in range(n-r+1, n+1):
        retVal *= i
    for i in range(2, r+1):
        retVal //= i
    return retVal


n = ii()

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

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

Solution (Python):
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

class PowMod:
	def __init__(self, N, base=[2]):
		self.mem = {}
		for b in base:
			pows = [1]
			for i in range(1, N+1):
				pows.append(pows[-1]*b % mod)
			self.mem[b] = pows

	def pow(self, b, n):
		return self.mem[b][n]

N = ri()

pm = PowMod(N, base=[8,9,10])
ans = pm.pow(10, N) - pm.pow(9, N)*2 + pm.pow(8, N)

print(ans % mod)

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

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

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

Solution (Python):
n=int(input())
a=1
b=1
c=1
p=10**9+7

for i in range(n):
    a=(a*10)%p
for i in range(n):
    b=(b*9)%p
for i in range(n):
    c=(c*8)%p
print((a-2*b+c)%p)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

ans = 1

for i in range(n):
    ans *= 10
    ans %= mod

ans_2 = 1

for i in range(n):
    ans_2 *= 9
    ans_2 %= mod
ans_3 = 1

for i in range(n):
    ans_3 *= 8
    ans_3 %= mod


print((ans - 2*ans_2 + ans_3) % mod)

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

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

print(ans)

Solution (Python):
from math import trunc
import sys
import copy
from collections import deque
import collections
import itertools
stdin = sys.stdin
import math

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n = ni()

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

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

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

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

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

def pow(x, n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x % MOD
        
        x = x**2 % MOD
        n >>= 1
    return res

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

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

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

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

Solution (Python):

import sys,math,collections,itertools
input = sys.stdin.readline
m=10**9+7
N=int(input())

nAll=pow(10,N,m)
nwo0 = pow(9,N,m)
nwo9 = nwo0
nwo09 = pow(8,N,m)
ans = nAll-nwo0-nwo9+nwo09
while ans<0:
    ans +=m
print(ans)

Solution (Python):



MAX=10**9+7
n = int(input())
res = 0
a = 1
b = 1
c = 1
for i in range(n):
    a *= 10
    a %= MAX
    b *= 9
    b %= MAX
    c *= 8
    c %= MAX
res += a - 2 * b + c
res %= MAX

print(res)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n = ni()
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())
if n==1:
    print(0)
else:
    ans=(10**n-2*9**n+8**n)%(10**9+7)
    print(ans)

Solution (Python):
MOD = 10**9+7
n = int(input())
all_cnt = pow(10,n,MOD)
no09 = pow(8,n,MOD)
yes09 = all_cnt-no09

no0 = pow(9,n,MOD)
yes0 = all_cnt-no0
yes9 = yes0

ans = yes0+yes9-yes09
print(ans%MOD)

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())
x=0
A=1
B=1
C=1
mod=10**9+7
while x<n:
    A=(A*10)%mod
    B=(B*9)%mod
    C=(C*8)%mod
    x+=1
B=(B*2)%mod
print((A-B+C)%mod)

Solution (Python):

import sys

sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


sys.setrecursionlimit(10**7)









INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


def run():
    N = int(input())
    N10 = pow(10, N, mod)
    N9 = pow(9, N, mod)
    N8 = pow(8, N, mod)
    ans = N10 - 2 * N9 + N8
    ans %= mod
    print(ans)


if __name__ == "__main__":
    run()

Solution (Python):


from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	prime = 10**9 + 7
	if n == 1:
		print(0)
	else:
		total = (10**n)%prime
		no0 = (9**n)%prime
		inter = (8**n)%prime
		ans = (total-(no0*2-inter)+prime)%prime
		print(ans)

	

main()

Solution (Python):
def main():
    MOD = 10**9 + 7
    N = int(input())
    n_10 = 1
    n_9 = 1
    n_8 = 1
    for _ in range(N):
        n_10 *= 10
        n_9 *= 9
        n_8 *= 8
        n_10 %= MOD
        n_9 %= MOD
        n_8 %= MOD
    print((2 * (n_10 - n_9) - (n_10 - n_8)) % MOD)


if __name__ == '__main__':
    main()

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

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

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

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

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

N = int(input())
if N == 1:
    print(0)
else:
    ALL = pow(10,N,MOD)
    p0 = pow(9,N,MOD)
    in0 = ALL - pow(9,N,MOD)
    in9 = ALL - pow(9,N,MOD)
    p09 = pow(8,N,MOD)
    in09 = ALL - p09
    print((in0+in9-in09)%MOD)

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

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

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

def pow(a):
  ans  = 1
  for i in range(n):
    ans = (ans * a) % p
  return ans
x = (pow(10) - pow(9) * 2 + pow(8)) % p
print(x)

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

a = 1
b = 1
c = 1

for _ in range(n):
    a = (a * 10) % mod
    b = (b * 9) % mod
    c = (c * 8) % mod
ans = (a - 2 * b + c) % mod
print(ans)

Solution (Python):
n = int(input())
ans_max = 1
for i in range(n):
    ans_max = ans_max * 10 % 1000000007

ans_mid = 1
for i in range(n):
    ans_mid = ans_mid * 9 % 1000000007
ans_mid = ans_mid * 2 % 1000000007

ans_min = 1
for i in range(n):
    ans_min = ans_min * 8 % 1000000007
ans = (ans_max - (ans_mid - ans_min)) % 1000000007
print(ans)

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

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

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



if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

print(ans)

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

if __name__ == "__main__":
    main()

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

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

    n = int(input().rstrip())

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

if __name__ == "__main__":
    resolve()

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

Solution (Python):


N = int(input())

mod = pow(10,9)+7

def pow_mod(x,n,mod):
    ans = 1
    for i in range(n):
        ans = (ans*x)%mod

    return ans

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

print(ans%mod)

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

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

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

    print(total)

main()

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

if N <= 1:
    print(0)
else:
    all_A = pow(10, N, MOD) + MOD
    non_0_9_A = pow(8, N, MOD)
    non_0_A = pow(9, N, MOD)
    e_0_A = (all_A - non_0_A) % MOD
    e_0_or_9_A = (all_A - non_0_9_A) % MOD
    print((e_0_A * 2 - e_0_or_9_A) % MOD)

Solution (Python):
n=int(input())
mul10=1
mul9=1
mul8=1
mod=1e9+7
for i in range(n):
    mul10*=10
    mul10%=mod
    mul9 *= 9
    mul9 %= mod
    mul8*=8
    mul8%=mod

ans=mul10-2*mul9+mul8
ans%=mod
print(int(ans)//1)

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())
zero = 9 ** N
nine = 9 ** N
zero_nine = 8 ** N
full = 10 ** N
ans = (full - zero - nine + zero_nine) % (10 ** 9 + 7)

print(ans)

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

def comb(n,k,p):
    """power_funcを用いて(nCk) mod p を求める"""
    from math import factorial
    if n<0 or k<0 or n<k: return 0
    if n==0 or k==0: return 1
    a=factorial(n) %p
    b=factorial(k) %p
    c=factorial(n-k) %p
    return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
    """a^b mod p を求める"""
    if b==0: return 1
    if b%2==0:
        d=power_func(a,b//2,p)
        return d*d %p
    if b%2==1:
        return (a*power_func(a,b-1,p ))%p

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

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

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):

from sys import stdin,stdout

n = int(stdin.readline())
mod = 1000000007
val = ((((pow(10,n,mod) - pow(9,n,mod))+mod)%mod -pow(9,n,mod) + mod)%mod + pow(8,n,mod))%mod
stdout.write(str(val))

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

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

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

Solution (Python):
N = int(input())
M = 10**9+7
Uset = 1
Aset = 1
Bset = 1
Cset= 1
for _ in range(N):
    Uset = (Uset*10)%M
    Aset = (Aset*9)%M
    Bset = (Aset*9)%M
    Cset = (Cset*8)%M
print((Cset+Uset-2*Aset)%M)

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

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

n = int(input())

ans = 1
for i in range(n):
    ans = ans*10%MOD

minus = 1
minus2 = 1
for i in range(n):
    minus = minus*8%MOD
    minus2 = minus2*9%MOD
    
print((ans-2*minus2+minus)%MOD)

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

Solution (Python):
n = int(input())
con = 1;
a = 1;
b = 1;

for i1 in range(n):
    con = (con * 10) % 1000000007;
for i2 in range(n):
    a = (a * 9) % 1000000007;
for i3 in range(n):
    b = (b * 8) % 1000000007;

c = (2*a - b)%1000000007;
con = (con - c)%1000000007;
print(con)

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

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

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

ans=0

for i in range(0,N-1):
    
    num09=N-i
    now=cmb(N, N-i,p)*(pow(2,N-i,p)-2)*pow(8,i,p)%p
    ans+=now
    ans%=p

print(ans)

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

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

def main():
    n = int(input())
    if n == 1:
        ans = 0
    else:
        mod = pow(10, 9)+7
        ans = (mod + pow(10, n, mod) + pow(8, n, mod) - 2*pow(9, n, mod)) % mod
    print(ans)
    
if __name__ == "__main__":
    main()

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):
def main():
    N = int(input())

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

if __name__ == '__main__':
    main()

Solution (Python):
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

n = ii()

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

Solution (Python):
N = int(input())
MOD = 10**9 + 7
def f(x, y): return pow(x, y, MOD)
print((f(10, N) - f(9, N) - f(9, N) + f(8, N) + MOD) % MOD)

Solution (Python):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

zero=pow(10,n,mod)-pow(9,n,mod)
nine=pow(10,n,mod)-pow(9,n,mod)
ans=zero+nine-(pow(10,n,mod)-pow(8,n,mod))
print(ans%mod)

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())

if N < 2:
    print(0)
    exit()
if N == 2:
    print(2)
    exit()
mod = 10**9 +7
ans = pow(10,N,mod)+pow(8,N,mod)-pow(9,N,mod)*2
ans %= mod
print(ans)

Solution (Python):
mod = 10**9+7
N = int(input())
if N == 1:
    print(0)
    exit()
plus = 1
minus = 1
cap = 1
for _ in range(N):
    plus *= 10
    minus *= 9
    cap *= 8
    plus %= mod
    minus %= mod
    cap %= mod
print((plus-2*minus+cap)%mod)

Solution (Python):
N = int(input())
mod = 10**9+7
x = 1
y = 1
z = 1
for i in range(N):
    x *= 9
    y *= 8
    z *= 10
    x %= mod
    y %= mod
    z %= mod
x *= 2
ans = z - x + y
print(ans%mod)

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

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

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

print(a)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = 10 ** N - 9 ** N - 9 ** N + 8 ** N
print(a % mod)

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

ten = [10]
nine = [9]
eight = [8]
for i in range(20):
    ten.append(ten[-1] ** 2 % mod)
    nine.append(nine[-1] ** 2 % mod)
    eight.append(eight[-1] ** 2 % mod)
ans = 0
num = bin(n)[2:]
temp10 = 1
temp9 = 2
temp8 = 1
for i in range(len(num)):
    if num[-i-1] == "1":
        temp10 *= ten[i]
        temp10 %= mod
        temp9 *= nine[i]
        temp9 %= mod
        temp8 *= eight[i]
        temp8 %= mod
ans = ans + temp10 - temp9 + temp8
ans %= mod
print(ans)

Solution (Python):
"""
方針
Uを求める(u)
0を含まないA(a)
9を含まないB(b=a)
AかつB(c)

ans = U - (2*a -c)
"""
n=int(input())
p=10**9+7
u=1

def clock(v, cnt):
  ret = 1
  for i in range(cnt):
    ret = (ret * v) % p
  return ret

u = clock(10, n)
a = clock(9, n)
c = clock(8, n)
ans = (u - (2*a - c))%p
print(ans)

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

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

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

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

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())
if n==1:
    print(0)
    exit()
no09=8**n
no0=9**n
print((10**n-9**n-(no0-no09))%(10**9+7))

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





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

mod=10**9+7
all_situation=power_func(10,n)

non_zero_situation=power_func(9,n)

non_nine_situation=power_func(9,n)

non_zero_and_nine_situation=power_func(8,n)

answer=(all_situation-non_zero_situation-non_nine_situation+non_zero_and_nine_situation)%mod
print(answer)

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())
n1 = 10**n
n2 = 9**n
n4 = 8**n
n3 = n1-2*n2+n4
a = 10**9+7
print(n3%a)

Solution (Python):
n = int(input())
total = 10**n
a1 = 9**n
a2 = 9**n
a12 = 8**n

ans = (total - a1 - a2 + a12) % (10**9 + 7)
print(ans)

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

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

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

Solution (Python):

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

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

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

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

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

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

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

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):
import sys
def input():
    return sys.stdin.readline()[:-1]


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

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

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


temp = pow(8, n, p)


tempp = pow(9,n,p)


temppp = pow(10,n,p)
    
res = (temppp-tempp*2 + temp) % p

print(res)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

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-2*b+c)%(10**9+7))

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

limit = 1000000007

def calc(k, n):
    a = 1

    for i in range(n):
        a *= k
        a = a % limit
    return a

X = calc(10, N) + calc(8, N) - 2 * calc(9, N)
X = X % limit

print(X)

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

mod=10**9+7

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

x=power_func(10,n,mod)
y=power_func(9,n,mod)
z=power_func(8,n,mod)

ans=(x-(y-z)*2-z)%mod

print(ans)

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

N = int(input())
a = 1
b = 1
c = 1
for _ 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):

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

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

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

mymod = 1000000007

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

Solution (Python):
def resolve():
    
    
    
    
    n=int(input())
    MOD=10**9+7
    dp=[[0]*4 for i in range(n+1)]
    dp[0][0]=1
    for i in range(1,n+1):
        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[n][3])

if __name__ == '__main__':
    resolve()

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

    mod = 10**9 + 7

    

    pattern = 10 ** n
    not_pattern = (9 ** n) + (9 ** n) - (8 ** n)

    answer = (pattern - not_pattern) % mod

    print(answer)


if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter



input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n = getN()
    a1 = pow(10, n, MOD)
    a2 = pow(8, n, MOD)
    a3 = pow(9, n, MOD) - a2
    
    print((a1 - 2 * a3 - a2) % MOD)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    
    solve()