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:
N = int(input())
#10^N−9^N−9^N+8^N
ans =10 ** N - 9 ** N - 9 ** N + 8 ** N
mod = 10 ** 9 + 7
print(ans % mod)

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10**9 + 7
a1, a2, a3 = 1, 1, 1

for _ in range(N):
    a1 *= 10
    a1 %= MOD

for _ in range(N):
    a2 *= 9
    a2 %= MOD
a2 *= 2
a2 %= MOD

for _ in range(N):
    a3 *= 8
    a3 %= MOD

ans = a1 - a2 + a3
ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
import sys


n = int(input())

pmax = 10 ** 9 + 7

if n == 1 or n== 0 :
    print('0')
    sys.exit()
    
elif n == 2:
    print('2')
    sys.exit()


x = 10 ** n % pmax
y = 9 ** n % pmax
z = 9 ** n % pmax
yz = 8 ** n % pmax

ans = (x - y - z + yz) % pmax


print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans=(10**N-9**N-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)
ans -= 2*pow(9,N,mod)
ans += pow(8,N,mod)
ans %= mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
ans=pow(10,N)-pow(9,N)*2+pow(8,N)
mod=pow(10,9)+7
print(ans%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())

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

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 178
# C - Ubiquity

N=int(input())

mod=10**9+7

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
#coding: utf-8

N = int(input())

p = 10**9 + 7

ret = pow(10, N, p)
ret -= pow(9, N, p)
ret -= pow(9, N, p)
ret += pow(8, N, p)

ret = (ret + p) % p

print(ret)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
#coding: utf-8

N = int(input())

p = 10**9 + 7

ret = pow(10, N)
ret -= pow(9, N) 
ret -= pow(9, N)
ret += pow(8, N)

ret %= p

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7
dp = [[0, 0, 0, 0] for _ in range(N)]

# dp[上から何桁目か][事象を4つに区分]
# dp[0][0]: 0も9も含まない
# dp[0][1]: (9は含むが)0を含まない
# dp[0][2]: (0を含むが)9を含まない
# dp[0][3]: 0も9も含む
dp[0][0] = 8
dp[0][1] = 1
dp[0][2] = 1
dp[0][3] = 0

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

print(dp[N-1][3])

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

Submission status: Accepted

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

a10 = 10**N
a9 = 9**N
a8 = 8**N
print((a10-a9-a9+a8) % MOD)

Submission status: Accepted

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

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

ans %= mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

if N == 2:
    print(2)
    exit()

# N >= 3

# 全事象
all_pattern = 10 ** N

# 0も9もない
pattern_a = 8 ** N

# 0あるが9ない
pattern_b = 9 ** N - 8 ** N

ans = all_pattern - pattern_a - pattern_b * 2
ans = ans % (10**9 + 7)

print(ans)

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

Submission status: Accepted

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

def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())

    return N


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 整数(1 <= N <= 10**6)
    """
    # 求解処理
    ans = 10**N - 2 * 9**N + 8**N
    ans %= 10**9 + 7

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N = get_input()

    # メイン処理
    main(N)

Submission status: Accepted

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

def pow_mod(a, n, MOD):
    ret = 1
    for i in range(n):
        ret = a * ret % MOD
    return ret

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

Submission status: Accepted

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

Submission status: Accepted

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

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)

print(ans % MOD)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())



div=10**9+7
def po(x,n,M):
    res=1
    if n>0:
        
        res= po(x,n//2,M)
    if n%2==0:
        res=(res*res)%M
    else:
        res=(((res*res)%M)*x)%M
        
      
    return res

A=po(10,N,div)
B=po(9,N,div)
C=po(8,N,div)
ans=(A-2*B+C)%div
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 10**9+7

allN = 10**N #全ての整数の列
left = 9 ** N #左端が0か9
right = 9 ** N #右端が0か9
ryoutan = 8 ** N #両端0か9

ncc =  allN - left - right + ryoutan
print(int(ncc%ans))

Submission status: Accepted

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

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)
ans -=pow(9,N,mod)*2
ans += pow(8,N, mod)

print(ans%mod)

Submission status: Accepted

Solution code:
def calc(intN):  

    ret=10**intN+8**intN-2*(9**intN)
    return ret%(10**9+7)

N = int(input())

print(calc(N))

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9+7
S = 10**N%mod
O = 8**N%mod

ans = ((S +O)%mod - 2*9**N%mod)%mod
print(ans)

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

mod = 1000000007

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

print(ans)

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:
##C - Ubiquity
##0と9が一つずつない状況
N = int(input())
print((10**N - 2*9**N + 8**N) % (10**9+7))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

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

# 再帰だとなんか通らん
# dp = {}
# def rec(i, zero, nine):
#     if (i, zero, nine) in dp:
#         return dp[(i, zero, nine)]
#     if i == n:
#         return 1 if (zero and nine) else 0
#     ret = 0
#     for j in range(10):
#         if j == 0:
#             ret += rec(i + 1, True, nine)
#         elif j == 9:
#             ret += rec(i + 1, zero, True)
#         else:
#             ret += rec(i + 1, zero, nine)
#         ret %= mod
#     dp[(i, zero, nine)] = ret
#     return ret

# print(rec(0, False, False))

dp = [[[0 for _ in range(2)] for _ in range(2)] for _ in range(10**6 + 10101)]
dp[0][0][0] = 1  # どういう意味なのかは不明
for i in range(n):
    for j in range(2):
        for k in range(2):
            for m in range(10):
                if m == 0:
                    dp[i + 1][1][k] += dp[i][j][k]
                    dp[i + 1][1][k] %= mod
                elif m == 9:
                    dp[i + 1][j][1] += dp[i][j][k]
                    dp[i + 1][j][1] %= mod
                else:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j][k] %= mod
print(dp[n][1][1])
# 869121

# 2511445

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)

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

if t==1:
  print(0)
else:
  kans = 1
  for i in range(t):
    kans *= 10
    kans = kans % mod
  
  ans = 1
  for i in range(t):
    ans *= 9
    ans = ans % mod
    
  bans = 1
  for i in range(t):
    bans *= 8
    bans = bans % mod
    
  f = kans - ans*2 + bans
  f = f%mod
  
  print(f)

Submission status: Accepted

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

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 if n!=1 else 0)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
MOD = 1000000007
print((pow(10, n) - pow(9, n)*2 + pow(8, n))%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)
print(ans%MOD)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
def main():
  MOD = int(1e9 + 7)
  n = int(input())
  print((pow(10,n,MOD) - 2*pow(9 , n , MOD)%MOD + pow(8 , n , MOD) + MOD)%MOD)
 
if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from functools import reduce

"""[summary]
全体：10^N
0が含まれない：9^N
9が含まれない：9^N
0,9の両方が含まれない：8^N
0,9のどちらか一方が含まれない：9^N + 9^N - 8^N
"""

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

calc = (10**N - 9**N - 9**N + 8**N) % mod

print(calc)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod =10**9+7
n=int(input())
if n<2:exit(print(0))
elif n==2:exit(print(2))

ans = 10**n - 9**n*2 + 8**n
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

ans = (ten - nine - nine + eight) % mod
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = int(rl())
	x = pow(10, n, MOD) - 2*pow(9, n, MOD) + pow(8, n, MOD)
	print(x % MOD)
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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))
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)
r=a-2*b+c
print(r%p)

Submission status: Accepted

Solution code:
n = int( input() )
#print( n )

#print( range( n-1 ) )

x = 1
y = 1
w = 1
z = 1000000007
for i in range( n ):
    x = ( x % z ) * 10
    y = ( y % z ) * 9
    w = ( w % z ) * 8
#    print( i, x, y )

ans = ( x % z ) - 2 * ( y % z ) + ( w % z )
print( ans % z )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mod = 10 ** 9 + 7


eight = pow(8, n, mod)
nine = pow(9, n, mod)
ten = pow(10, n, mod)

ans = (ten - nine - nine + eight) % mod


print(ans)

Submission status: Accepted

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

def po(a,n):
    r = 1
    while n != 0:
        if n % 2 == 1:
            r = (r*a)%p
        a = (a*a)%p
        n = n//2
    return r

print((po(10,N)-2*po(9,N)+po(8,N))%p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

# setrecursionlimit(10**7)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n = int(rl())

	dp = [[[0 for k in range(2)] for j in range(2)] for i in range(n+1)]
	dp[0][0][0] = 1

	for i in range(n):
		for j in range(2):
			for k in range(2):
				for d in range(10):
					nj = j or d == 0
					nk = k or d == 9
					dp[i+1][nj][nk] += dp[i][j][k]
					dp[i+1][nj][nk] %= MOD 

	ans = dp[n][1][1]
	print(ans)
	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=10**9+7
total=(10**n)%p
except_0=(9**n)%p
except_9=except_0
except_both=(8**n)%p
# double reduced from [1,8]
# so add that
print((total-except_0-except_9+except_both)%p)

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

mod = 10**9+7
n = int(input())
ret = 0
ret += pow(10,n,mod)
ret -= 2 * pow(9,n,mod)
ret %= mod
ret += pow(8,n,mod)
ret %= mod
print(ret)

Submission status: Accepted

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

ans = pow(10,n,MOD) - pow(9,n,MOD) - pow(9,n,MOD) + pow(8,n,MOD) 
print((ans+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:
def pow(a,b):
    ans=1
    if b==0:
        return 1
    for i in range(b):
        ans=ans*a
        if ans > mod:
            ans=ans%mod
    return ans%mod
        
        
mod=1000000007

n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

    print(ans%mod)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
n = int(input())
ans10 = 10
ans9 = 9
ans8 = 8
for i in range(n - 1):
    ans10 = ans10 * 10 % MOD
    ans9 = ans9 * 9 % MOD
    ans8 = ans8 * 8 % MOD
ans = (ans10 - ans9 - ans9 + ans8) % MOD
ans = (ans + MOD) % MOD
print(ans)

Submission status: Accepted

Solution code:
tmp = 10 ** 9 + 7

def div(n,T):
    _ = 1
    for t in range(T):
        _ *= n
        _ %= tmp
    return _
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 10 ** 9 + 7

N = int(input())

result = 0

ten = pow(10, N, mod)
nine = pow(9, N, mod)
eight = pow(8, N, mod)

result = (ten - 2 * nine + eight) % mod

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
mod = 1000000007
all = pow(10, n, mod)
s1 = 2 * pow(9, n, mod) % mod
s2 = pow(8, n, mod) % mod
ans = int(all - s1 + s2)%mod
if ans < 0:
    ans += mod
print(ans%mod)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10 ** 9 + 7
alln = pow(10,N,mod)
zeronine = pow(9,N,mod)
nothing = pow(8,N,mod)
ans = (alln - zeronine * 2 + nothing) % mod
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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    s = int(input())
    mod = 10**9+7

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

n = 10 ** s - 9 ** s - 9 ** s + 8 ** s

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

Submission status: Accepted

Solution code:
N = int(input())
M = 7 + 10 ** 9
A = 0


def fac_mod(a, b):
    x = 1
    for i in range(1, b+1):
        x = (x*a) % M
    return x


A = (fac_mod(10, N) - fac_mod(9, N) * 2 + fac_mod(8, N)) % M
if A < 0:
    A = M + A
print(A)

Submission status: Accepted

Solution code:
MOD = 10**9 + 7
n = int(input())
ans = MOD + 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())
mod=10**9+7
ans=pow(10,n,mod)
ans-=pow(9,n,mod)*2
ans+=pow(8,n,mod)
ans%=mod

print(ans)

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())
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())
a = 10**9+7
def mod(i,j):
    ans = 1
    for _ in range(j):
        ans = (ans*i)%a
    return(ans)

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

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline().rstrip("\n"))
h = 10 ** 9 + 7
n_10 = pow(10,n,h)
n_9 = pow(9,n,h)
n_8 = pow(8,n,h)
ans = (n_10 - 2*n_9 + n_8) % h
print(ans)

Submission status: Accepted

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

answer = (pow(10, N, MOD) + pow(8, N, MOD) - 2 * pow(9, N, MOD)) % MOD
print(answer + MOD if answer < 0 else answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:UTF-8
import sys

def pow_r(x, n):
    if n == 0:
        return 1
    if n % 2 == 0:
        return pow_r(x ** 2, n //2)
    else:
        return x * pow_r(x ** 2, (n - 1) // 2)

if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    n = int(input())    # 数字
    # a = input()     # 文字列
    # a = list(map(int, input().split()))     # スペース区切り連続数字
    # a = input().split()     # スペース区切り連続文字列
    # a = [int(c) for c in input()]   # 数字→単数字リスト変換

    # 定数行入力
    # x = 5
    # a = [int(input()) for _ in range(x)] # 数字
    # a = [input() for _ in range(x)] # 文字
    # a = [list(map(int, input().split())) for _ in range(x)]     # スペース区切り連続数字(行列)
    # a = [input().split() for _ in range(x)]     # スペース区切り連続文字
    # a = [[int(c) for c in input()] for _ in range(x)]  # 数字→単数字リスト変換(行列)

    # スペース区切り連続 数字、文字列複合
    # a = []
    # for _ in range(x):
    #     aa, bb = input().split()
    #     a.append((int(aa), bb))

    # ------ 処理 ------#
    S = pow(10, n)

    M = pow(9, n)
    M2 = pow(8, n)

    out = (S - (M + M - M2)) % (1000000000 + 7)

    # ------ 出力 ------#
    print("{}".format(out))

Submission status: Accepted

Solution code:
MOD=10**9+7

n=int(input())

# 全通りの計算
#print(10**n)

# 0と9の値が存在しない通りの計算
#print(8**n)

# 9の値が存在しない通りの計算
#print(9**n)

# 0の値が存在しない通りの計算
#print(9**n)

# 0もしくは9のどちらか一方も存在しない通りの計算
#print(9**n+9**n-8**n)

# 0、9が共に存在する通りの計算
sum=10**n-(9**n+9**n-8**n)
#print(10**n-(9**n+9**n-8**n))

# 答えの出力
print(sum%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)
print(ans%MOD)

Submission status: Accepted

Solution code:
n = int(input())
mod = 1000000007
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 = 1000000007
ans = 10**n - 9**n - 9**n +8**n
print(ans%mod)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=int(input())
MOD=1000000000+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
ans = 10**n - 9**n - 9**n + 8**n
print(ans % mod)

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:
# coding:UTF-8
import sys

def pow_r(x, n):
    if n == 0:
        return 1
    if n % 2 == 0:
        return pow_r(x ** 2, n //2)
    else:
        return x * pow_r(x ** 2, (n - 1) // 2)

if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    n = int(input())    # 数字
    # a = input()     # 文字列
    # a = list(map(int, input().split()))     # スペース区切り連続数字
    # a = input().split()     # スペース区切り連続文字列
    # a = [int(c) for c in input()]   # 数字→単数字リスト変換

    # 定数行入力
    # x = 5
    # a = [int(input()) for _ in range(x)] # 数字
    # a = [input() for _ in range(x)] # 文字
    # a = [list(map(int, input().split())) for _ in range(x)]     # スペース区切り連続数字(行列)
    # a = [input().split() for _ in range(x)]     # スペース区切り連続文字
    # a = [[int(c) for c in input()] for _ in range(x)]  # 数字→単数字リスト変換(行列)

    # スペース区切り連続 数字、文字列複合
    # a = []
    # for _ in range(x):
    #     aa, bb = input().split()
    #     a.append((int(aa), bb))

    # ------ 処理 ------#
    S = pow_r(10, n)

    M = pow_r(9, n)
    M2 = pow_r(8, n)

    out = (S - (M + M - M2)) % (1000000000 + 7)

    # ------ 出力 ------#
    print("{}".format(out))

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:
def func(x, n):
  res = 1
  for _ in range(n):
    res = res * x % MOD
  return res

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

ans = func(10, n) - func(9, n) - func(9, n) + func(8, n)
ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
MOD=10**9+7

n=int(input())
ans= 10**n - 9**n - 9**n + 8**n
print(ans%MOD)

Submission status: Accepted

Solution code:
from sys import stdin, stdout

MOD = int(1e9+7)

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    stdout.write(str((pow(10, N, MOD)-(2*pow(9, N, MOD))+pow(8, N, MOD))%MOD))

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

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())
mod = 10**9+7

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
mod=10**9+7

N=int(input())

a,b,c=1,1,1

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

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

Submission status: Accepted

Solution code:
MOD=10**9+7
N=int(input())
print((pow(10,N,MOD)-2*pow(9,N,MOD)+pow(8,N,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())
mod = 10**9+7
part1 = 10 **n 
part2 = 8 ** n
part3 = 2 * (9 ** n) #-
part1 %= mod
part2 %= mod
part3 %= mod
print((part1 +part2 - part3)%mod)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n10 = 1
for _ in range(n):
    n10 = n10 * 10 % mod
n9 = 1
for _ in range(n):
    n9 = n9 * 9 % mod
n8 = 1
for _ in range(n):
    n8 = n8 * 8 % mod

ans = n10 - 2 * n9 + n8
print(ans % mod)

Submission status: Accepted

Solution code:
def resolve():
    md = 10**9+7
    N = int(input())
    dpt = [[0,0,0,0] for _ in range(N)]
    dpt[0][0]=8
    dpt[0][1]=1    
    dpt[0][2]=1
    dpt[0][3]=0

    for i in range(1,N):
        dpt[i][0] =(dpt[i-1][0]*8)%md 
        dpt[i][1] =(dpt[i-1][1]*9+dpt[i-1][0])%md
        dpt[i][2] =(dpt[i-1][2]*9+dpt[i-1][0])%md
        dpt[i][3] =(dpt[i-1][3]*10+dpt[i-1][1]+dpt[i-1][2])%md
    print(dpt[-1][-1])
resolve()

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 # MOD

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10**9 +7

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


ans = (powmod(10,N) - powmod(9,N) - powmod(9,N) + powmod(8,N)) % mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(A)

Submission status: Accepted

Solution code:
N = int(input())

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