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())
MOD=10**9+7
MAX=N+1
def powermod(base,ind):
  if ind==1:
    return base
  elif ind%2==0:
    return (powermod(base,ind//2)**2)%MOD
  else:
    return ((powermod(base,ind//2)**2)*base)%MOD

print((powermod(10,N)-2*powermod(9,N)+powermod(8,N))%MOD)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
MOD = 10**9+7

def main():
    n = int(input().strip())
    buf = 9**n
    ans = 10**n - buf - buf + 8**n
    print(ans%MOD)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
input = stdin.readline
MOD = 10**9+7

def main():
    n = int(input().strip())
    ans = 10**n - 9**n - 9**n + 8**n
    print(ans%MOD)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main2():
    N = int(input())
    mod = 10**9 + 7
    ans = 10**N - 9**N - 9**N + 8**N
    print(ans % mod)
    
if __name__ == "__main__":
    main2()

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 10**n - (2*9**n - 8**n)
r = c % mod
print(r)

Submission status: Accepted

Solution code:
n = int(input())
state10 = 1
state9 = 1
state8 = 1
mod = 10**9 + 7
for _ in range(n):
  state10 *= 10
  state10 %= mod
  state9 *= 9
  state9 %= mod
  state8 *= 8
  state8 %= mod

ans = state10 - 2*state9 + state8
ans %= mod
print(ans)

Submission status: Accepted

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

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

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:
from sys import stdin

input = stdin.readline

MOD = 10**9 + 7



def solve():
    n = int(input())
    print((pow(10,n,MOD) - pow(9,n,MOD) * 2 + pow(8,n,MOD))%MOD)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
mod = 1000000007


def fexp(x, y):
    ans = 1
    while y > 0:
        if y % 2 == 1:
            ans = ans * x % mod
        x = x * x % mod
        y //= 2
    return ans


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

Submission status: Accepted

Solution code:
N = int(input())

div = 10**9 + 7

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

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:
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())
ans = 0
num = 1
for i in range(n):
  num *= 10
  num %= 10 ** 9 + 7
ans += num
num = 1
for i in range(n):
  num *= 9
  num %= 10 ** 9 + 7
ans -= num * 2
num = 1
for i in range(n):
  num *= 8
  num %= 10 ** 9 + 7
ans += num
while ans < 0:
  ans += 10 ** 9 + 7
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

mod = 7 + 10 ** 9

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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:
import math
n=int(input())
a=1000000007
print( (pow(10,n)-pow(9,n)*2+pow(8,n))%a)

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
# Aiは1桁の非負の整数
# Ai==0がある
# Ai==9がある

# 10通りある

mod = 10**9+7
N = int(input())
# 全てのパターンから，0がないパターン - 9がないパターン + 0も9もないパターン
# pow(base, exp, mod])  # modはoptional
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())
x=(10**N-2*(9**N)+8**N)%(10**9+7)
print(x)

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    K = int(1e9) + 7
    ans = pow(10, N, K) - pow(9, N, K) - pow(9, N, K) + pow(8, N, K)
    print(ans%K)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def f(n):
    mod = 1000000007
    return (pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod

n = int(input())
print(f(n))

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 = 1
ans1 = 1
ans2 = 1
mod = 1000000007
for i in range(n):
	ans = (ans*10)%mod
	ans2 = (ans2*8)%mod
	ans1 = (ans1*9)%mod
ans = (ans - ans1 + mod)%mod
ans = (ans - ans1 + mod)%mod
ans = (ans + ans2)%mod
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys

input = iter(sys.stdin.read().splitlines()).__next__

MOD = 1000000007

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

N = int(input())

total = powmod(10, N)

#print(total)

cnt_without0 = powmod(9, N)
cnt_without9 = cnt_without0
cnt_without0nor9 =  powmod(8, N)

res = (total - cnt_without0 - cnt_without9 + cnt_without0nor9) % MOD
if res < 0:
   res += MOD

print(res)

Submission status: Accepted

Solution code:
def solve(n):
    a, b, c, m = 1, 1, 1, 1
    mod = 1000000007
    while n > 0:
        if n & 1:
            a = (a * 10 ** m) % mod
            b = (b * 9 ** m) % mod
            c = (c * 8 ** m) % mod
        n >>= 1
        m *= 2
    print((a - 2*b + c) % mod)

solve(int(input()))

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) - pow(9,n,mod) + pow(8,n,mod))%mod)

Submission status: Accepted

Solution code:
N = int(input())
# x の y 乗を d で割った余りを求める
def powmod(x, y, d):
    ret = 1
    for _ in range(1, y+1):
        ret = ret * x % d
    return ret
ans = powmod(10, N, 10**9+7) - powmod(9, N, 10**9+7)*2 + powmod(8, N, 10**9+7)

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

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

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

else:
  a=(((10)**N)%(((10)**9)+7))
  b=(((8)**N)%(((10)**9)+7))
  c=(((9)**N)%(((10)**9)+7))
  d=((c*2)%(((10)**9)+7))
  f=((a+b-d)%(((10)**9)+7))
  print(f)

Submission status: Accepted

Solution code:
n=int(input())
ans=10**n
ans-=2*9**n
ans+=8**n
ans%=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:
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(readline())


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


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


def lcm(a, b):
    # 最小公倍数
    g = gcd(a, b)
    return a // g * b


# 0かつ9が1回は登場する数列の種類
# 0−9からなる数列集合から 1を含まない集合 U 9を含まない集合 を引く
# つまり答えは
# 10^n - 2*(9^n) + 8^n
N = a_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
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())

def powmod(x, y):
    ret = 1
    for _ in range(1, y+1):
        ret = ret * x % (10**9+7)
    return ret
ans = powmod(10, N) - powmod(9, N)*2 + powmod(8, N)
print(ans % (10**9+7))

Submission status: Accepted

Solution code:
#n = int(input()) #入力
#a, b = (int(x) for x in input().split())
#a, b = map(int, input().split())

#a = [int(x) for x in input().split()]
#a = list(map(int, input().split()))
#a = [list(map(int,input().split(" "))) for i in range(N)]   #2次元


#a.sort() # C++ の sort(a.begin(), a.end());
#a.append(3) # C++ の a.push_back(3);


#exit(0) # return 0 的な。終了できる。
## 整数の切り捨て除算は // (ダブルスラッシュ)


#a[始まりの位置: 終わりの位置: スライスの増分] # (a は配列)


#import numpy as np  #importに100 ms 程度かかる。
import math
import copy
import string
#math.gcd(a, b) で、gcd 計算できる。
#math.pi は円周率。

INF = int(10**18) #べき乗 C++ の pow(10, 18) or 1e18;
pi = math.pi

MOD = 1000000007
#MOD = 1000000009
#MOD = 998244353




#繰り返し2乗法
#N^aの、Mで割った余りを求める。
def my_pow(N, a, M):
    if(a == 0):
        return 1
    else:
        if(a % 2 == 0):
            tempo = my_pow(N, a/2, M)
            return (tempo * tempo) % M
        else:
            tempo = my_pow(N, a - 1, M)
            return (tempo * N) % M




#N_C_a を M で割った余り
def my_combination(N, a, M):
    res = 1

    for i in range(0, a):
        res *= N - i
        res %= M

    for i in range(0, a):
        res *= my_pow(i + 1, M - 2, M)
        res %= M

    return res




#N_C_i を M で割った余りを、v[i] に代入する。
def my_combination_table(N, M, v):
    if(len(v) < N + 1):
        l = N + 1 - len(v)
        tempo = [1] * l
        v.extend(tempo)

    for i in range(1, N + 1):
        v[i] = v[i - 1] * (N - (i - 1))
        v[i] %= M

        v[i] *= my_pow(i, M - 2, M)
        v[i] %= M

    return




#math.factorial で階乗は計算できる。
#math.gcd で gcd は計算できる。
#np.gcd.reduce(A) #(Aは配列) で、Aの全ての要素の gcd が計算できる。



N = int(input())
res = 10 ** N - 2 * (9 ** N) + 8 ** N
res %= MOD

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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:
import numpy as np

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

Submission status: Accepted

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

def pow(n, num):
  s = num
  for i in range(1,n):
    s = s*num%mod
  return s
print((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if(n == 1):
  print(0)
elif(n==2):
  print(2)
else:
  print((10**n - 2*9**n + 8**n)%(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:
n=int(input())
print((10**n-2*9**n+8**n)%1000000007)

Submission status: Accepted

Solution code:
n = int(input())

all_result = 10 ** n
nothing = 8 ** n
only_1 = 9 ** n

result = all_result + nothing - 2 * only_1

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

Submission status: Accepted

Solution code:
N=int(input());M=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())
a=1;b=1;c=1
MOD=10**9+7
for i in range(N):
  a=a*10%MOD
  b=b*9%MOD
  c=c*8%MOD

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import defaultdict
from collections import deque
import bisect
from decimal import *
def main():
    N = I()
    mod = 10 ** 9 + 7
    print((pow(10, N, mod) - (2 * pow(9, N, mod) % mod) + pow(8, N, mod)) % mod)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
mod = 10 ** 9 + 7
start,zero,nine,ans = 1,0,0,0
for i in range(n):
  ans = (ans * 10 + zero + nine) % mod
  zero = (zero * 9 + start) % mod
  nine = (nine * 9 + start) % mod
  start = (start * 8) % mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n==1:
	print(0)
elif n==2:
	print(2)
else:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

Solution code:
N = int(input())
dp = [[0] * 4 for i in range(N+1)]
MOD = 10**9+7
dp[0][0] = 1
for i in range(1,N+1):
    dp[i][0] = (dp[i-1][0] * 8) % MOD
    dp[i][1] = (dp[i-1][0] + dp[i-1][1]*9) % MOD
    dp[i][2] = (dp[i-1][0] + dp[i-1][2]*9) % MOD 
    dp[i][3] = (dp[i-1][3]*10 + dp[i-1][1] + dp[i-1][2]) % MOD
#print(dp)
print(dp[N][3])

Submission status: Accepted

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

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
"""
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
"""
a = ans%mod
print(a)

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) - (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_all = 10 ** N
p_no0 = 9 ** N
p_no9 = 9 ** N
p_no09 = 8 ** N

ans = (p_all - p_no0 - p_no9 + p_no09) % (10 ** 9 + 7)

print(ans)

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)%m)

Submission status: Accepted

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

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:
input_line = int(input())

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

Submission status: Accepted

Solution code:
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]
mod = 10**9+7
n = I()
if n == 1:
  print(0)
else:
  ##（すべての順列）-（0をつかってないもの）-（9をつかってないもの）+（0も9もつかってないもの）
  print((10**n-2*9**n+8**n)%mod)

Submission status: Accepted

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

answer = (10**N - 9**N) + (10**N - 9**N) - (10**N - 8**N)

print(answer % MOD)

Submission status: Accepted

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

s = 10 ** n
s0 = 9 ** n
s9 = 9 ** n
sb = 8 ** n

ans = s - s0 - s9 + sb
print(ans % mod)

Submission status: Accepted

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

if n == 1:
    print(0)

else:
    ans = 10 ** n - 9 ** n - 9 ** n + 8 ** n
    print(ans % d)

Submission status: Accepted

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

Sall = pow(10, N, MOD)
S0 = S9 = pow(9, N, MOD)
S09 = pow(8, N, MOD)

ans = (Sall - (S0 + S9 - S09)) % 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:
def main(N):
    if N==1:
        return 0
    elif N==2:
        return 2
    else:
        return (10**N - (9**N*2 - 8**N))%(10**9 + 7)

if __name__ == '__main__':
    N = int(input())
    ans = main(N)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

in_9=10**N-9**N
in_0=10**N-9**N
nine_and_zero=10**N-8**N

ans=int(int(in_0+in_9-nine_and_zero)%MOD)

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)
print(ans%mod)

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())
a1 = 9 ** n
a2 = 9 ** n
a3 = 8 ** n
ans = 10**n - (a1 + a2 - a3)
print(ans%(10**9+7))

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

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

print(ans%MOD)

Submission status: Accepted

Solution code:
MOD = 10**9 + 7

N = int(input())

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

Submission status: Accepted

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

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n = readint()

mod = 10**9+7


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

Submission status: Accepted

Solution code:
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

# sys.setrecursionlimit(10 ** 5)

mod =  1000000007
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

a=ii();print((pow(10,a,mod)+pow(8,a,mod)-2*pow(9,a,mod))%mod)

Submission status: Accepted

Solution code:
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

mod =  10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii();print((pow(10,a,mod)+pow(8,a,mod)-2*pow(9,a,mod))%mod)
for _ in range(1):
    solve()

Submission status: Accepted

Solution code:
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

mod =  1000000007
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii();print((pow(10,a,mod)+pow(8,a,mod)-2*pow(9,a,mod))%mod)
for _ in range(1):
    solve()

Submission status: Accepted

Solution code:
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

mod =  1000000000+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii();print((pow(10,a,mod)+pow(8,a,mod)-2*pow(9,a,mod))%mod)
for _ in range(1):
    solve()

Submission status: Accepted

Solution code:
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii();print((pow(10,a,mod())+pow(8,a,mod())-2*pow(9,a,mod()))%mod())
for _ in range(1):
    solve()

Submission status: Accepted

Solution code:
import math
from decimal import *
import random
from datetime import datetime
import time

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#                               #
    # author : samars_diary #
    # 16-09-2020 │ 18:28:11 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii()
    print(((10**a)-2*(9**a)+(8**a))%mod())
for _ in range(1):
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = int(1e9+7)

N = int(input())

# all posible list
Na = pow(10, N, MOD)

# number of list without 0
N0 = pow(9, N, MOD)

# number of list without both 0 and 9
N09 = pow(8, N, MOD)

M = Na - 2*N0 + N09

print(M%MOD)

Submission status: Accepted

Solution code:
n = int(input())

mod = 10 ** 9 + 7
dp = [[[0 for _ in range(2)] for _ in range(2)] for _ in range(n)]
dp[0][0][0] = 8
dp[0][0][1] = 1
dp[0][1][0] = 1
dp[0][1][1] = 0

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

print((dp[-1][-1][-1]) % mod)

Submission status: Accepted

Solution code:
N=int(input())

#Ai=0を含まない...9^N
#Ai=9を含まない...9^N
#Ai=0,Ai=9を含まない...8^N
#全てで10^N通り
#Ai=0,Ai=9の少なくとも一方が存在しない 9^N+9^N-8^N
#答は10^N-9^N-9^N+8^N
MOD=10**9+7
print((pow(10,N,MOD)-2*pow(9,N,MOD)+pow(8,N,MOD))%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:
"""AtCoder Beginner Contest 178.

C
"""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


def main():
    """Run."""
    mod = 1000000007
    n = int(input())

    ans = 0

    if n <= 1:
        ans = 0
    elif n == 2:
        ans = 2
    else:
        ans = 10**n
        ans -= 9**n
        ans -= 9**n
        ans += 8**n

    print(ans % mod)


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:
MOD = int(1e9+7)


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
MOD=1000000007
ans=0
N=int(input())
def modpow(a,x):
    ret=1
    while x>0:
        if x%2==1:
            ret*=a
            ret%=MOD
        a*=a
        x>>=1
    return ret

ans=modpow(10,N)+2*(MOD-modpow(9,N))+modpow(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:
N = int(input())
MOD = 10**9 + 7


N0 = 9 ** N % MOD
N9 = 9 ** N % MOD
NA = 10 ** N % MOD
NB = 8 ** N % MOD

ans = ( NA - (N0 + N9 - NB) ) % MOD
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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