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())
print((pow(10, N,1000000007)-2*pow(9, N, 1000000007)+pow(8, N, 1000000007))%1000000007)

Solution (Python):
n = int(input())
mod = 10**9 + 7
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())
mod = (int)((10**9)+7)
if n < 2:
    print(0)
else:
    ans = 2*pow(9,n,mod) - pow(8,n,mod)
    a2 =  pow(10,n,mod)
    a = a2-ans
    if(a<0) :a+=mod
    print(a%mod)

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

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

Solution (Python):
n = int(input())
if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    big = 10**9 + 7
    a0 = 10
    b0 = 9
    c0 = 8
    a = 1
    b = 1
    c = 1
    for i in range(n):
        a = (a % big) * a0
        b = (b % big) * b0
        c = (c % big) * c0
    ans = a - b * 2 + c
    if ans < 0:
        ans += big
    print(ans % big)

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

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

if(N == 1):
  count = 0
else:
  Pmax = 10**N 
  P0out = 9**N 
  P9out  = 9**N 
  P09out = 8**N 
  
  count = Pmax - P09out - (P0out - P09out) - (P9out - P09out)
  
  
print(int(count%mod))

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

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

total = (10**N) % MOD
sub_total = (9**N) % MOD
and_total = (8**N) % MOD

ans = (total - 2*sub_total + and_total)%MOD

print(ans)

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

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

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

Solution (Python):



N=int(input())

MOD=10**9+7

A10,A9,A8=dict(),dict(),dict()

A10[1]=10
A9[1]=9
A8[1]=8

c=1
while(1):
    c*=2
    if c>N: 
        c/=2
        break
    A10[c]=A10[c/2]**2
    A9[c]=A9[c/2]**2
    A8[c]=A8[c/2]**2
    if c*2>N: break

B10,B9,B8=1,1,1
while(1):
    B10*=A10[c]
    B10%=MOD
    B9*=A9[c]
    B9%=MOD
    B8*=A8[c]
    B8%=MOD
    N-=c
    if N<=0: break
    while(1):
        c/=2
        if c<=N: break
    
ans=B10-2*B9+B8
ans%=MOD

print(ans)

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

Solution (Python):
n = int(input())
MOD = 10 ** 9 + 7
n_all = (10 ** n) % MOD
zero_or_nine_all = (9 ** n) % MOD
not_zero_and_nine_all = (8 ** n) % MOD

t = (zero_or_nine_all - not_zero_and_nine_all) % MOD

ans = (n_all - zero_or_nine_all -t) % 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

input = sys.stdin.readline

n = int(input())
p = 1000000007
n_10 = power_func(10,n,p)
n_9 = power_func(9,n,p) * 2 % p

n_8 = power_func(8,n,p)

if n_10 - n_9 + n_8 < 0:
    print(n_10 - n_9 + n_8 + p)
else:
    print(n_10 - n_9 + n_8)

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

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








if N==1:
    print(0)
    exit()
All = pow(10,N,L)
C09 = All - pow(8,N,L)
C9 = All - pow(9,N,L)
C0 = All - pow(9,N,L)
print((-C09+C9+C0)%L)

Solution (Python):
N = int(input())
Ori = 10 ** N % 1000000007

cnt = 0

cnt -= 8 ** N % 1000000007


cnt += 9 ** N % 1000000007


cnt += 9 ** N % 1000000007

ans = (Ori - cnt)  % 1000000007

print(ans)

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

def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv


def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD

fac,finv,inv=facinv(N)

ans=0

for i in range(2,N+1):
    a=pow(8,N-i,MOD)
    b=COM(N,i)
    c=(pow(2,i,MOD)-2+MOD)%MOD
    ans=(ans+a*b*c)%MOD
print(ans)

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

n10 = 1
n8 = 1
n9 = 1
for _ in [0]*N:
    n10 = n10*10 %(10**9+7)
    n8 = n8*8 %(10**9+7)
    n9 = n9*9 %(10**9+7)

ans = (n10+n8-2*n9)%(10**9+7)
print(ans)

Solution (Python):
N = int(input())
MOD = 10**9 + 7
base = 1
aorb = 2

for i in range(N):
    base = (base * 10) % MOD
    aorb = (aorb * 9) % MOD
aandb = 1
for i in range(N):
    aandb = (aandb * 8) % MOD
ans = (base - (aorb - aandb)) % MOD

print(ans)

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

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

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

if ans < 0:
    ans += MOD

print(ans % MOD)

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n = k()

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

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

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

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

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

total = 10 ** n % (10 ** 9 + 7)
part1 = 2 * 9 ** n % (10 ** 9 + 7)
part2 = 8 ** n % (10 ** 9 + 7)

result = total - part1 + part2

if result < 10 ** 9 + 7:
    print(result % (10 ** 9 + 7))
elif result < (-(10 ** 9 + 7)):
    print(result % (10 ** 9 + 7) + (10 ** 9 + 7))
else:
    if result < 0:
        print(result + (10 ** 9 + 7))
    else:
        print(result)

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

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

ans=ans%mod

print(ans)

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

num=10**n-2*9**n+8**n

numa=num%(10**9+7)

print(numa)

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

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

m = 1000000007

x = [i for i in range(n)]
x0 = [i for i in range(n)]
x9 = [i for i in range(n)]
x09 = [i for i in range(n)]

x[0] = 8
x0[0] = 1
x9[0] = 1
x09[0] = 0

for i in range(1, n):
    x[i] = x[i-1] * 8 % m
    x0[i] = (x0[i-1] * 9 + x[i-1]) % m
    x9[i] = (x9[i-1] * 9 + x[i-1]) % m
    x09[i] = (x09[i-1] * 10 + x0[i-1] + x9[i-1]) % m

print(x09[n-1])

Solution (Python):
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq

M = 10 ** 9 + 7

def solve(N):
    if N == 1:
        return 0
    if N == 2:
        return 2
    else:
        ans = pow(10, N, M)
        ans -= pow(9, N, M) * 2
        ans += pow(8, N, M)
    return ans
if __name__ == "__main__":
    N = int(input())
    print(solve(N) % M)

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

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

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

a=power_func(10,N,mod)
b=power_func(9,N,mod)
c=power_func(8,N,mod)
ans=(a+c-(2*b))%mod
print(ans)

Solution (Python):
p=1000000007
a=int(input())
b=2*(9**a)
c=8**a
b=b%p
c=c%p
d=(b-c)%p
e=(10**a)%p
f=(e-d)%p
if f<0:
    print(f+p)
else:
    print(f)

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

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

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

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

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

if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    a = 10 ** 2
    b = 2 * 9 ** 2
    c = 8 ** 2
    mod = 10 ** 9 + 7
    ans = 0
    for i in range(N-2):
        a = a * 10 % mod
        b = b * 9 % mod
        c = c * 8 % mod
        ans = a - b + c
        ans %= mod
    print(ans)

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

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

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

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

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

Solution (Python):
N = int(input())
na = pow(9, N)
nb = na
na_and_nb = pow(8, N)
na_or_nb = na + nb - na_and_nb
a_and_b = pow(10, N) - na_or_nb
print(a_and_b % (pow(10, 9) + 7))

Solution (Python):
mod = 10**9+7
N = int(input())
ans = pow(10, N, mod)
a = pow(9, N, mod)
b = pow(8, N, mod)

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

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

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

if n < 2:
    print(0)
else:
    print((10**n - (9**n*2 - 8**n)) % hoge)

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    mod = 10 ** 9 + 7

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

    tmp1 = 1
    for i in range(N):
        tmp1 *= 9
        tmp1 %= mod

    tmp2 = 1
    for i in range(N):
        tmp2 *= 8
        tmp2 %= mod

    ans -= tmp1*2
    ans += tmp2
    ans %= mod

    print(ans)

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

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

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

mod = 1000000007

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

print(K%mod)

Solution (Python):
N = int(input())
MOD = 10 ** 9 + 7
res = pow(10, N, MOD) - 2 * pow(9, N, MOD) + pow(8, N, MOD)
if res < 0:
    while res < 0:
        res += MOD
elif res > MOD:
    while res > MOD:
        res -= MOD
print(res)

Solution (Python):
n=int(input())
c=10**9+7
def pow_c(x,n,c):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K= (K%c)*(x%c)%c
        x = ((x%c)**2)%c
        n //= 2
    return (K%c) * (x%c) %c

k10=pow_c(10,n,c)
k9=pow_c(9,n,c)
k8=pow_c(8,n,c)
ans=(k10-2*k9+k8)%c 
print(ans)

Solution (Python):
def resolve():
    N = int(input())
    All = 1
    No0 = 1
    No09 = 1
    for i in range(N):
        All = All * 10 % (10**9+7)
        No0 = No0 * 9 % (10**9+7)
        No09 = No09 * 8 % (10**9+7)
    ans = All - 2*No0 + No09
    print(ans % (10**9+7))

resolve()

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

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

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

print(ans)

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

MOD = 10**9+7

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

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

mod = 10**9 +7

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

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

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

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

Solution (Python):

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

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

Solution (Python):


import sys

class CUbiquity:
    def solve(self, tc=0):
        MOD = 10 ** 9 + 7

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



solver = CUbiquity()
input = sys.stdin.readline

solver.solve()

Solution (Python):
'''
Created on 2020/09/13

@author: okazakieiichiro
'''
d = 10 ** 9 + 7
n = int(input())

ret = None
if n < 2:
    ret = 0
elif n == 2:
    ret = 2
else:
    ret = 10 ** n + 8 ** n - 2 * 9 ** n
ret %= d
print(ret)

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



x1=8**n  
x2=(9**n-8**n)*2  





y=10**n


answer=y-(x1+x2)
ans=answer%(10**9+7)

print(ans)

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

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

x = 10**9 + 7

a = 10**N % x
b = 2 * 9**N % x
c = 8**N % x

ans = (a-b+c)%x

print(ans)

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

a = 10**n
e0 = 9**n
e9 = 9**n
e09 = 8**n
print(int((a-(e0+e9-e09))%(10**9+7)))

Solution (Python):
import sys

sys.setrecursionlimit(2000)

N = int(input())

mod = 1000000007

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

a = power(10, N)
b = power(9, N)
c = power(8, N)

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

Solution (Python):
def modpow(a, b, m):
	if b == 0:
		return 1
	else:
		c = modpow(a, b//2, m)
		c = (c*c)%m
		return c if b%2 == 0 else (c*a)%m

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

Solution (Python):
import sys

def test(N):
    answer = 0
    for i in range(1, 10**N):
        s = ("%0" + str(N) +"d") % i
        if "0" in s and "9" in s:
            
            answer += 1
    return answer

def solve(N):
    MOD = 10**9+7
    dp = [[0, 0, 0, 0] for i in range(N+1)]
    dp[0] = [1, 0, 0, 0]
    A = 0
    B = 1
    C = 2
    D = 3
    for i in range(1, N+1):
        
        dp[i][A] = (dp[i-1][A]*8) % MOD
        dp[i][B] = (dp[i-1][A]   + dp[i-1][B]*9) % MOD
        dp[i][C] = (dp[i-1][A]   + dp[i-1][C]*9) % MOD
        dp[i][D] = (dp[i-1][B]   + dp[i-1][C]    + dp[i-1][D]*10) % MOD
        
    return dp[N][D]

N = int(input())
print(solve(N))

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

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

Solution (Python):
n = int(input())
_num = 10**9 + 7
result = 1
result_no0 = 1
result_no9 = 1
result_no09 = 1
for i in range(n):
    result = (result * 10) % _num
    result_no0 = (result_no0 * 9) % _num
    result_no09 = (result_no09 * 8) % _num
print(int((result - result_no0 * 2 + result_no09) % _num))

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




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

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

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

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

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from math import gcd
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7

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

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

if N == 1 or N == 2:
    print((N-1)*2)
    exit()

kumi = 10**N
kata = 9**N - 8**N
zen = 8**N
x = (10**9)+7
print((kumi-(2*kata)-zen)%x)

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

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

Solution (Python):

N = int(input())
non_zero = 9**N
non_nine = 9**N
non_both = 8**N
all = 10**N
res = all - non_zero - non_nine + non_both
print(res % (10**9+7))

Solution (Python):

N = int(input())

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

Z = 10 ** 9 + 7
a = 1
b = 1
c = 1
for n in range(N):
    a *= 10
    b *= 9
    c *= 8

    a = a % Z
    b = b % Z
    c = c % Z

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

Solution (Python):




N = int(input())





if(N == 1):
    print(0)
else:
    tmp1 = 1;
    tmp2 = 1;
    tmp3 = 1;
    for i in range(N):
        tmp1 = (tmp1 * 8) % 1000000007;
        tmp2 = (tmp2 * 9) % 1000000007;
        tmp3 = (tmp3 * 10) % 1000000007;
    print((tmp3 - (tmp2 + tmp2 - tmp1)) % 1000000007)

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

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

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

Solution (Python):
N = int(input())
mod = 10**9 + 7
if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    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-2*b+c)%mod)

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

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

Solution (Python):

N = int(input())

MOD = 10**9+7


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


print(ans)

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

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

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

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

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

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

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

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


def func(a, n):
    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())
n = func(10, N)
no_0 = func(9, N)
no_9 = func(9, N)
no_09 = func(8, N)
ans = (n - no_0 - no_9 + no_09)
if ans < 0:
    ans += p
if ans < 0:
    ans += p
print(ans)

Solution (Python):
import sys
from io import StringIO
import unittest

MOD = 1000000007


def resolve():
    N, = map(int, input().split())
    tmp = [[8, 1], [1, 0]]
    nxt = [[0, 0], [0, 0]]
    for i in range(1, N):
        nxt[0][0] = (tmp[0][0] * 8) % MOD
        nxt[0][1] = ((tmp[0][0] * 1) % MOD + (tmp[0][1] * 9) % MOD) % MOD
        nxt[1][0] = ((tmp[0][0] * 1) % MOD + (tmp[1][0] * 9) % MOD) % MOD
        nxt[1][1] = ((tmp[0][1] * 1) % MOD + (tmp[1][0] * 1) % MOD + (tmp[1][1] * 10) % MOD) % MOD
        
        tmp[0][0]=nxt[0][0]
        tmp[0][1] = nxt[0][1]
        tmp[1][0] = nxt[1][0]
        tmp[1][1] = nxt[1][1]

    print(tmp[1][1]% MOD)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """869121"""
        output = """2511445"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """3"""
        output = """54"""
        self.assertIO(input, output)



if __name__ == "__main__":
    resolve()

Solution (Python):


N = int(input())


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


print(ans)

Solution (Python):
m10 = [10]
m9 = [9]
m8 = [8]
N = int(input())
mod = 10**9 + 7

i = 0
while 2**i<N:
  i += 1
  m10.append((m10[-1]**2)%mod)
  m9.append((m9[-1]**2)%mod)
  m8.append((m8[-1]**2)%mod)


ans8 = 1
ans9 = 1
ans10 = 1
for j in range(i+1):
  if N>>j & 1:
    ans8  = (ans8*m8[j])%mod
    ans9  = (ans9*m9[j])%mod
    ans10  = (ans10*m10[j])%mod
ans = ans8 + ans10 - 2*ans9
ans %= mod
print(ans)

Solution (Python):
n = int(input())
pre_ans = pow(10,n) - 2*pow(9,n) + pow(8,n)

ans = pre_ans % (pow(10,9)+7)
print(ans)

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

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

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

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

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

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

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

if a<=1:
	print(0)

else:
	n=(10**a)-(9**a)*2+(8**a)
	print(n%1000000007)

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

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

if N == 1:
    print(0)
    

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

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

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

a = 0
b = 1
c = 1
d = 8

mod = 10**9 + 7

for _ in range(N-1):
    a = (a * 10 + b + c) % mod
    b = (b * 9 + d) % mod
    c = (c * 9 + d) % mod
    d = (d * 8) % mod
print(a)

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

x=(10**N)
y=(2*(9**N))
z=(8**N)

print((x-y+z)%(10**9+7))

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

print(ans%INF)

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

a=N*(N-1)
b=10**(N-2)
c=10**N
d=8**N

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

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

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

def f(num):
    res = 1
    for _ in range(n):
        res *= num
        res %= MOD
    res %= MOD
    return res

print((f(10)-f(9)-f(9)+f(8))%MOD)

Solution (Python):

MOD=1000000007
x = int(input())
n1 = (10**x)%MOD
n2 = 2*9**x%MOD
n3 = 8**x%MOD
n = (n1-n2+n3+MOD)%MOD
print(int(n))

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

Solution (Python):

import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b
def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

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

    a = 10 ** N % mod
    b = 9 ** N % mod
    c = 8 ** N % mod
    ans = a - b - b + c
    ans %= mod
    print(ans)

if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

Solution (Python):
def calc_pow(x, y):
    if y == 0:
        return 1

    else:
        ans = calc_pow(x, y//2)**2

        if y%2:
            ans *= x
        
        return ans % 1000000007

N = int(input())

k = calc_pow(8, N) + calc_pow(10, N) - 2*calc_pow(9, N)
print(k % 1000000007)

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

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

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

mod = 1000000007

cnt_all= 10**n%mod
cnt_90=8**n%mod
cnt_9=9**n%mod
cnt_0=cnt_9%mod
cnt=(cnt_all + cnt_90 - cnt_9 - cnt_0)%mod

print(cnt)

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

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

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

def main():
    if N == 1:
        return 0

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


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

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

N = int(input())
A = 10 ** N
B = 8 ** N
C = 10 ** N - 9 ** N
D = C * 2 - A + B
print(D % mod)

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

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

print(int(ans))

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
p=10**9+7
n=int(input())
print((power_func(10,n,p)-power_func(9,n,p)-power_func(9,n,p)+power_func(8,n,p))%p)

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

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

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

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

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

toki = 10**n
shigi = 8**n
nue = 9**n

print((toki-nue-nue+shigi)%iri)

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

def modpow(a, n, mod):
    res = 1
    n_bi = str(format(n, 'b'))

    for i in range(len(n_bi)):
        res = (res*res) % mod
        if n_bi[i] == "1":
            res = (res*a) % mod
        
    return res

p = 1000000007

if (N == 1):
    print(0)
elif (N == 2):
    print(2)
else:
    temp = (modpow(10, N, p) - modpow(9, N, p)) % p
    temp = (temp - modpow(9, N, p)) % p
    temp = (temp + modpow(8, N, p)) % p
    print(temp)

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

fi = 1
se = 1
tot = 1
mod = 10**9 + 7
for i in range(0,n):
    fi*=8
    fi%=mod
    se*=9
    se%=mod
    tot*=10
    tot%=mod
se*=2
se-=fi
print((tot - se)%mod)

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

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

Solution (Python):
MOD = 1000000007

def fpow(x, n):
    e = 1
    while n > 1:
        if n & 1: e = (e*x) % MOD
        x = (x*x) % MOD
        n >>=1
    return (x*e)%MOD

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

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

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

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

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

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

MOD = 1000000007

@njit
def solve(dp, N):
    dp[0, 0] = 8
    dp[0, 1] = 2
    dp[0, 2] = 0
    for i in range(1, N):
        dp[i, 0] = dp[i - 1, 0] * 8 % MOD
        dp[i, 1] = (dp[i - 1, 0] * 2 + dp[i - 1, 1] * 9) % MOD
        dp[i, 2] = (dp[i - 1, 1] + dp[i - 1, 2] * 10) % MOD
    return dp[N - 1, 2]


N = int(input())
dp = np.empty((N, 3), dtype=np.int32)
ans = solve(dp, N)
print(ans)

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

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

Solution (Python):

"""
Created on Sun Sep 13 21:20:10 2020

@author: naoki
"""

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

Solution (Python):

import sys

MOD = 1000000007  


def solve(N: int):
    t = pow(10,N,MOD)- pow(8,N,MOD)
    m = pow(10,N,MOD)- pow(9,N,MOD)
    print((2*m-t)%MOD)
    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())

mod = 10**9+7

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

Eight=1
Seven=1

for i in range(2,N+1):
    Eight*=9
    Seven*=8
    ok=(Eight- Seven)%mod
    OK=OK*10+ok*2
    OK%=mod
    Eight%=mod
    Seven%=mod
print(OK)

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

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-b*2)%mod)+c)%mod
print(ans)

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

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

Solution (Python):



def powmod(a, b):
    result = 1;
    for i in range(b):
        result *= a
        result %= 1e9 + 7
    return result


n = int(input())

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    
    r = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n)
    r = int(r % (1e9 + 7))
    print(r)

Solution (Python):
import sys




import math







stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    
    
    
    
    
    a = (10 ** n )%MOD
    b = (9 ** n)%MOD
    c = (8 ** n)%MOD
    print((a-b*2+c)%MOD)



if __name__ == '__main__':
    solve()

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    M = 10**9 + 7
    if N == 1:
        print(0)
        return
    ans = 0
    ans = 10**N - (9**N)*2 + 8**N 
    print(ans%M)    

if __name__ == '__main__':
    main()

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