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:
def power(a, e, m):
  s = 1
  while e>0:
    if e % 2 == 1:
      s = s * a % m
    a = a * a % m
    e = int(e / 2 % m)
  return s

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# region header
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
import copy
# @lru_cache(maxsize=None)
# sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
# endregion
# region input function


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


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


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


# endregion


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if(N == 1):
  count = 0
else:
  Pmax = 10**N #全組み合わせ数
  P0out = 9**N #0が入らない
  P9out  = 9**N #9が入らない
  P09out = 8**N #0も9も入らない
  
  count = Pmax - P09out - (P0out - P09out) - (P9out - P09out)
  
  
print(int(count%mod))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

#a^n mod p を求める
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = 10**9+7
# -0が存在しない-9が存在しない+0,9の両方が存在しない
# (0が存在する+9が存在する)-(0,9野どちらかが存在する)
# 0、9のどちらかがある場合 = 全体(10**N)-8**N
# ０が存在する場合=全体-0が存在しない場合(9**N)
# 9が存在する場合=全体-9が存在しない場合
# 0は存在するけど9は存在しない
# 0or9のどちらかがある場合は?
# 100-81
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)

Submission status: Accepted

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

cnt = 0
# 0と9が一個もない
cnt -= 8 ** N % 1000000007

# 0はあるが9が無い
cnt += 9 ** N % 1000000007

# 9はあるが0が無い
cnt += 9 ** N % 1000000007

ans = (Ori - cnt)  % 1000000007

print(ans)

Submission status: Accepted

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

#nCr
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans=ans%mod

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

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

print(numa)

Submission status: Accepted

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

Submission status: Accepted

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

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())
x = 10**N+8**N-2*9**N
y = 10**9+7
print(x%y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
ANS = (10 ** N) - (2 * (9 ** N)) + (8 ** N)
ANSANS = ANS % (10 ** 9 + 7)
print(ANSANS)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 1000000007

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

print(K%mod)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

MOD = 10**9+7

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

Submission status: Accepted

Solution code:
n = int(input())

mod = 10**9 +7

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

Solution code:
# @author 

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())


##{0,9}の組み合わせなし
x1=8**n  ##{0}も{9}も一切ない
x2=(9**n-8**n)*2  ##{0}もしくは{9}がない




##{0,9}関係なし全組み合わせ
y=10**n


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

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
            #print(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):
        # 0 
        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
        #print(i, dp[i], sum(dp[i]))
    return dp[N][D]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
#not 0,9 -> 8**N
#include 0 but not 9 -> 9**N - 8**N
#include 9 but not 0 -> 9**N - 8**N
#all -> 10**N
print((10**N - (2 * 9**N - 8**N)) % (10**9 + 7))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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))

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
N = int(input())
#開業されたN個要素を受け付ける
#input_list = [list(map(int, input().split())) for i in range(N)]

#print("test")

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)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# input
N = int(input())

MOD = 10**9+7

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

# output
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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
        # print(nxt)
        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()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())

# 求解処理
ans = 2 * (10**N - 9**N) - (10**N - 8**N)
ans %= 10**9 + 7

# 結果出力
print(ans)

Submission status: Accepted

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

#print(m10, i)
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)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
a=int(input())

if a<=1:
	print(0)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

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

Submission status: Accepted

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

print(ans%INF)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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))

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:
#!/usr/bin/env python3
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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("{} - {} - {} + {} = {}".format(cnt_all,cnt_9,cnt_0,cnt_90,cnt))
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(int(ans))

Submission status: Accepted

Solution code:
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    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)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
num=int(input())

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

Submission status: Accepted

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

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

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