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



Sample input:
2


Sample output:
2

Submission status: Accepted

Solution code:
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
mod = 10**9+7
n = int(input())
ans=0
ans+=pow(10, n, mod)
ans-=pow(9, n, mod)*2
ans+=pow(8, n, mod)
print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
#from collections import deque
#from functools import *
#from fractions import Fraction as f
from copy import *
from bisect import *	
#from heapq import *
#from math import ceil
#from itertools import permutations ,product
 
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1
 
#sys.setrecursionlimit(10**6)
if zz:
	input=sys.stdin.readline
else:	
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')
di=[[-1,0],[1,0],[0,1],[0,-1]]
def inc(d,c,x=1):
	d[c]=d[c]+x if c in d else x
def bo(i):
	return ord(i)-ord('A')	
def li():
	return [int(xx) for xx in input().split()]
def fli():
	return [float(x) for x in input().split()]	
def comp(a,b):
	if(a>b):
		return 2
	return 2 if a==b else 0		
def gi():	
	return [xx for xx in input().split()]
def fi():
	return int(input())
def pro(a): 
	return reduce(lambda a,b:a*b,a)		
def swap(a,i,j): 
	a[i],a[j]=a[j],a[i]	
def si():
	return list(input().rstrip())	
def mi():
	return 	map(int,input().split())			
def gh():
	sys.stdout.flush()
def isvalid(i,j):
	return 0<=i<n and 0<=j<m and a[i][j]!="."
def bo(i):
	return ord(i)-ord('a')	
def graph(n,m):
	for i in range(m):
		x,y=mi()
		a[x].append(y)
		a[y].append(x)
mod=10**9+7
t=1
while t>0:
	t-=1
	n=fi()
	dp=[[1]*4 for i in range(n+2)]
	dp[-1]=[1,0,0,0]
	for i in range(n+1):
		dp[i][0]=dp[i-1][0]*8
		dp[i][1]=dp[i-1][0]+dp[i-1][1]*9
		dp[i][2]=dp[i-1][0]+dp[i-1][2]*9
		dp[i][3]=dp[i-1][3]*10+dp[i-1][1]+dp[i-1][2]
		for j in range(4):
			dp[i][j]%=mod
			
	print(dp[n-1][3])

Submission status: Accepted

Solution code:
mod = 1000000007

n = int(input())

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


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

Submission status: Accepted

Solution code:
N = int(input())
M = 1000000007
t, t1, t2 = 1, 1, 1

for _ in range(N):
    t, t1, t2 = t*10, t1*9, t2*8
    t, t1, t2 = t%M, t1%M, t2%M

print((t - t1*2 + t2) % M)

Submission status: Accepted

Solution code:
N = int(input())
M = 10**9+7
A = 8**N
B = 9**N
C = 10**N
ans = (C - B*2 + A)%M
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

print(ans%mod)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

n = r()
tens=1
nines=1
eights=1
mod = 10**9+7
for i in range(n):
    tens=(tens*10)%mod
    nines=(nines*9)%mod
    eights=(eights*8)%mod
print((tens-2*nines+eights)%mod)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())

all = (10 **N) % mod
no_zero = (9**N) % mod
no_nine = (9**N) 
no_zero_nine = 8 ** N

A = 1
no_zero = 1
no_nine = 1
no_zero_nine = 1

for i in range(N):
    A = A * 10 % mod
    no_zero = no_zero * 9 % mod
    no_zero_nine = no_zero_nine * 8 % mod

ans = (A - (no_zero * 2 - no_zero_nine)) % mod
    

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
import math
ans = 0
if n == 1:
    ans =0
if n == 2:
    ans = 2
if n >= 3:
    ans = (10**n%(10**9+7)-9**n%(10**9+7)-9**n%(10**9+7)+8**n%(10**9+7))%(10**9+7)
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

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


def powmod(val, n, mod):
    # vals = [val]*n
    # ret = reduce(lambda x, y: x * y % mod, vals)

    # return ret

    ret = 1
    for i in range(n):
        ret = ret * val % mod

    return ret


all = powmod(10, N, mod)
b = powmod(9, N, mod)
c = powmod(8, N, mod)

ans = (all - (2*b - c))%mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def powmod(val, n, mod):
    ret = 1
    for i in range(n):
        ret = ret * val % mod

    return ret


all = powmod(10, N, mod)
b = powmod(9, N, mod)
c = powmod(8, N, mod)

ans = (all - (2*b - c))%mod

print(ans)

Submission status: Accepted

Solution code:
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) % mod
    print(v)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

def cal(N):
    return abs(10**N - 9**N - 9**N +  8**N) % (10**9+7)

print(cal(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
mod = 1000000007
def powmod(x,y):
  res = 1
  for i in range(y):
    res = res*x%mod
  return res
ans = powmod(10,N)-powmod(9,N)-powmod(9,N)+powmod(8,N)
ans = ans%mod
ans = (ans + mod)%mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
sys.setrecursionlimit(1000000)

N = int(input())

MAX_N=10**6
MOD=10**9+7

fac=[None for i in range(MAX_N)]
finv=[None for i in range(MAX_N)]
inv=[None for i in range(MAX_N)]

def COMinit(num):
    global fac
    global finv
    global inv
    fac[0]=1
    fac[1]=1
    finv[0]=1
    finv[1]=1
    inv[1]=1

    for i in range(2,num):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD

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


#a**n mod p を再帰的に求める
def modPow(a,n,p):

    if n==0:
        return 1
        
    if n == 1:
        
        #n=1ならaを返す
        return a % p

    elif n % 2 == 1:
        #nが奇数ならば a * modPow(a,n-1(偶数),p)を返す
        return a * modPow(a,n-1,p) % p

    else:
        #nが偶数なら modPow(a,n//2,p) * modPow(a,n//2,p)とすると速い
        t = modPow(a,n//2,p)
        return t * t % p

COMinit(MAX_N)

if N>2:
    ans = (modPow(10,N,MOD) - 2*modPow(9,N,MOD) + modPow(8,N,MOD))%MOD
elif N == 1:
    ans = 0
elif N == 2:
    ans = 2

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
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()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mod = 10 ** 9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10**9 + 7
val1 = pow(9,N,MOD)

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

Submission status: Accepted

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

all_ptn = 10 ** n
anti_ptn = 2 * (9 ** n) - 8 ** n

print((all_ptn - anti_ptn) % p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
# cording:utf-8

# Nを入力
N = int(input())

# 答えは10**N-9**N-9**N+8**N
print((10 ** N - 9 ** N - 9 ** N + 8 ** N) % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

N = int(input())

def solve():
    mod = 10**9+7
    ans = 10**N - (9**N)*2 + 8**N
    ans %= mod
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def main():
    mod = 10**9 + 7
    n = int(input())
    all = pow(10, n, mod)
    non_0 = non_9 = pow(9, n, mod)
    non_0_and_9 = pow(8, n, mod)
    ans = all - non_0 - non_9 + non_0_and_9
    print(ans % mod)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

sousuu = 10 ** N
not9 = 9 ** N
not0 = 9 ** N
not09 = 8 ** N
print((sousuu - not9 - not0 + not09) % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
N = int(input())
MOD = 1000000007

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

Submission status: Accepted

Solution code:
# 21:17-                                                                                                                                                      
N = int(input())

kMod = 10**9+7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

mod = 10**9+7
N = int(input())
'''
def modpow(x,y):
    res = 1
    for _ in range(y):
        res = res * x % mod
    return res
'''
def modpow(a,n):
    res = 1
    while n > 0:
        if n & 1:
            res = res *a % mod
        a = a * a % mod
        n >>= 1
    return res

def main():
    ans = 0
    x0 = modpow(8,N)
    x1 = modpow(9,N)
    x2 = modpow(10,N)
    ans = (x2-2*x1+x0)%mod    

    print(ans)
main()

Submission status: Accepted

Solution code:
MOD = 1e9 + 7
n = int(input())
ans = [[0, 1, 1, 8]]
for i in range(n-1):
    a, b, c, d = ans.pop()
    a = (a * 10 + b + c) % MOD
    b = (b * 9 + d) % MOD
    c = (c * 9 + d) % MOD
    d = (d * 8) % MOD
    ans.append([a, b, c, d])

a, b, c, d = ans.pop()
print(int(a))

Submission status: Accepted

Solution code:
NUM = 1000000007

N = int(input())

all_colab = pow(10, N)
except_0or9_colab = pow(9, N)
except_0and9_colab = pow(8, N)

include_0and9_colab = all_colab - (2*except_0or9_colab - except_0and9_colab)

print(include_0and9_colab % NUM)

Submission status: Accepted

Solution code:
n=int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

Q = 10 ** 9 + 7

a10 = 1
a9 = 1
a8 = 1

for _ in range(N):
    a10 *= 10 
    a9 *= 9 
    a8 *= 8
      
    a10 %= Q
    a9 %= Q
    a8 %= Q

ans = (a10 - (2 * a9 - a8)) % Q

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

n = int(input())

m = 10**9+7

a = 10 ** n

b = 9 ** n

c = 9 ** n

d = 8 ** n

ans = (a-(b+c-d)) % m

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10 ** 9 + 7
D = [0] * 4
D[0] = 1

for i in range(N):
	ND = list(D)
	ND[0] = (D[0] * 8) % MOD
	ND[1] = (D[0] + D[1] * 9) % MOD
	ND[2] = (D[0] + D[2] * 9) % MOD
	ND[3] = (D[3] * 10 + D[1] + D[2]) % MOD
	D = ND

print(D[-1])

Submission status: Accepted

Solution code:
n = int(input())
mod = int(1e9)+7
bad = pow(9, n, mod) * 2 - pow(8, n, mod)
good = pow(10, n, mod)
print((good - bad) % mod)

Submission status: Accepted

Solution code:
import math

N=int(input())
if N==1:
    result=0
else:
    # 全体-0含まない-9含まない+0も9も含まない
    result=(10**N-2*(9**N)+8**N)%(10**9+7)

print(result)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9 + 7
dp = [[0]*4 for _ in range(N+1)]
dp[1][0] = 8
dp[1][1] = 1
dp[1][2] = 1

for i in range(2, 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]%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
MOD = 10**9+7

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9 + 7
contain_zero = 0
contain_nine = 0
not_contain_zero_and_nine = 0
all_per = pow(10,n,mod)
if n < 2:
    print(0)
else:
    contain_zero = all_per - pow(9,n,mod)
    contain_nine = all_per - pow(9,n,mod)
    not_contain_zero_and_nine = pow(8,n,mod)
    print((-(all_per - not_contain_zero_and_nine -contain_nine - contain_zero))%mod)

Submission status: Accepted

Solution code:
N = int(input())

#U:0~9の整数でN桁の数列 = 10**N
#A:0を含まないN桁の数列 = 9**N
#B:9を含まないN桁の数列 = 9**N

#ans = |U-(A∪B)| = |U|-|A|-|B|+|A∩B|

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

print(ans)

Submission status: Accepted

Solution code:
MOD = 10**9 + 7

n = int(input())

ans = pow(10, n, MOD)

ans -= 2 * pow(9, n, MOD)

ans += pow(8, n, MOD)

ans %= MOD

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9 + 7
def inv(x):
    return pow(x, mod - 2, mod)
def comb(n, k):
    ue = 1
    shita = 1
    n %= mod
    for i in range(k):
        ue = ue * (n - i) % mod
        shita = shita * (i + 1) % mod
    return ue * inv(shita) % mod
if N == 1:
    print(0)
else:
    print((pow(10,N,mod)-2*pow(9,N,mod)+pow(8,N,mod))%mod)

Submission status: Accepted

Solution code:
n = int(input())
nPowTen = pow(10,n,pow(10,9) + 7)
nPowNine = pow(9,n,pow(10,9) + 7)
nPowEight = pow(8,n,pow(10,9) + 7)

print((nPowTen - nPowNine - nPowNine +nPowEight) % (pow(10,9) + 7))

Submission status: Accepted

Solution code:
def main():
    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)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

MOD_VALUE = math.pow(10, 9) + 7

def pow_mod(value, pow):
    ret = 1
    for _ in range(pow):
        ret = ret * value % MOD_VALUE
    return ret

result = pow_mod(10, N) - pow_mod(9, N) * 2 + pow_mod(8, N)

print(int(result % MOD_VALUE))

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
MOD = 10**9+7
a=10
b=9
c=8
for i in range(n-1):
    a*=10
    b*=9
    c*=8
    if i%10==0:
        a=a%MOD
        b=b%MOD
        c=c%MOD

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

Submission status: Accepted

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


def _mod(x, y):
    res = 1
    for i in range(y):
        res = (res * x) % mod
    return res


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

Submission status: Accepted

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


def _mod(x, y):
    res = 1
    for i in range(y):
        res = (res * x) % mod
    return res


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

MOD = 1000000007

def mod(n):         
  return n % MOD

def modpow(a, n):   #mod(a**n)を高速で求める
    res = 1  
    digit = len(str(bin(n))) - 2
    for i in range(digit):
      if (n >> i) & 1:
        res *= mod(a)
        res = mod(res)
      a = mod(a**2)
    return mod(res)
  
ans = modpow(10, n)
ans -= 2*modpow(9, n)
ans += modpow(8, n)
print(mod(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
nAll = 10**n
nOne = 2*(9**n)
nBoth = 8**n
print((nAll - nOne + nBoth)%(10**9+7))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]


def modpow(a, n, mod):
    # a^nをmodでわったあまり 二分累乗法O(logn)
    res = 1
    while n > 0:
        if n & 1:
            res = (res*a) % mod
        a = (a*a) % mod
        n = n >> 1
    return res


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

Submission status: Accepted

Solution code:
N = int(input())
mod = 10** 9 + 7
ten = (10**N) % mod
nine = (9**N) % mod
eight = (8**N) % mod
answer= ten - nine*2 + eight
print(answer % mod)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
MOD = 10**9+7
def mod(x):
    return x % MOD

def solve(n):
    """
    0: {}
    1: {0}
    2: {9}
    3: {0,9}
    """
    x = [1,0,0,0]
    for i in range(n):
        x = list(map(mod, (
            8*x[0],
            (9*x[1] + x[0]),
            (9*x[2] + x[0]),
            (10*x[3] + x[2] + x[1])
        )))
    return x[3]

n = int(input())
print(solve(n))

Submission status: Accepted

Solution code:
MOD = 10**9+7
def solve(n):
    """
    0: {}
    1: {0}
    2: {9}
    3: {0,9}
    """
    dp = [[0]*4 for i in range(n+1)]
    dp[0][0] = 1
    x = [1,0,0,0]
    for i in range(n):
        x = [
            (8*x[0]) % MOD,
            (9*x[1] + x[0]) % MOD,
            (9*x[2] + x[0]) % MOD,
            (10*x[3] + x[2] + x[1]) % MOD
        ]
    return x[3]

n = int(input())
print(solve(n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10**9+7
def solve(n):
    """
    0: {}
    1: {0}
    2: {9}
    3: {0,9}
    """
    dp = [[0]*4 for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        dp[i+1][3] = (10*dp[i][3] + dp[i][2] + dp[i][1]) % MOD
        dp[i+1][2] = (9*dp[i][2] + dp[i][0]) % MOD
        dp[i+1][1] = (9*dp[i][1] + dp[i][0]) % MOD
        dp[i+1][0] = (8*dp[i][0]) % MOD
    return dp[n][3]

n = int(input())
print(solve(n))

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

S_all = pow(10, N, MOD)
S_0 = pow(9, N, MOD)
S_9 = S_0
S_09 = pow(8, N, MOD)

ans = (S_all - (S_0 + S_9 - S_09)) % MOD
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n =10**9 + 7
a = (10**N) % n
b = (9**N) % n
c = (8**N) % n

x = (a - 2*b + c) % n
print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    num = int(input())
    con = 10**9 + 7
    a, b, c = 1, 1, 2
    for i in range(num):
        a *= 10
        a %= con
        b *= 8
        b %= con
        c *= 9
        c %= con
    if(a+b-c < 0):
        print(a+b-c+con)
        return 0
    print(a+b-c)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
N = int(input())
#all_numは0~9の数字から成るNの数列の全部の個数
all_num = 10**N
#not_9は9が数列のどこにもいない数列の個数
#よって、(-not_9)は9が数列のどこかにいる数列の個数
not_9 = 9**N
#not_0は0が数列のどこにもいない数列の個数
#よって、(-not_0)は9が数列のどこかにいる数列の個数
not_0 = 9**N
#(-not_9) ∩ (-not_0)　=  0と9が両方ともどこかにいる数列
#よって、積集合をひかないといけない
#not_0_9は 0と9が両方ともどこにもいない数列
not_0_9 = 8**N
print((all_num-(not_9+not_0)+not_0_9) % (10**9+7))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
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)