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:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

def main():
    N = I()
    print((pow(10, N, MOD) - (pow(9, N, MOD) + pow(9, N, MOD) - pow(8, N, MOD))) % MOD)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import math
#from queue import *
#import random
#sys.setrecursionlimit(int(1e6))
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

n=inp()
mod=int(1e9+7)

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans % mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

nai_0 = 9 ** n
nai_9 = 9 ** n
nai_09 = 8 ** n

zenbu = 10 ** n

print((zenbu - nai_0 - nai_9 + nai_09) % (10 ** 9 + 7))

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

dp = [[0,0,0,0]for i in range(n+1)]
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][1] + dp[i-1][2] + dp[i-1][3] * 10) % mod
print(dp[-1][3])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())

MOD = 10 ** 9 + 7

ALL = pow(10, N, MOD)
ONE = pow(9, N, MOD)
TWO = pow(8, N, MOD)

ans = ALL - ONE - ONE + TWO
ans %= MOD

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

MOD = 10 ** 9 + 7


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = 1
b = 1
c = 1
p = 10**9+7
N = int(input())
i = 0
while i < N:
  a = (a*10)%p
  b = (b*9)%p
  c = (c*8)%p
  i += 1
print((a-2*b+c)%p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
n = int(input())
mod = 1000000007
def pow(a,n):
    if n == 0:
        return 1
    if n % 2 == 0:
        tmp = pow(a, n//2)
        return (tmp * tmp) % mod
    else:
        tmp = pow(a, n//2)
        return (a * tmp ** 2) % mod

all_pos = pow(10, n)
no_9 = pow(9, n)
no_0 = no_9
no_90 = pow(8,n)

ans = (all_pos - no_9 - no_0 + no_90) % mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    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)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

mod = 10 ** 9 + 7

N = int(input())

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
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())
p = 10**9+7
X1 = pow(10,N,p)
X2 = pow(9,N,p)
X3 = pow(8,N,p)
out = (X1-(X2+X2-X3))%p
print(out)

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:
N=int(input())
p=10**9+7

def pow_k(x,n,p=10**9+7):
    if n==0:
        return 1
    K=1
    while n>1:
        if n%2!=0:
            K=(K*x)%p
        x=(x*x)%p
        n//=2
    return (K*x)%p


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

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

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

Submission status: Accepted

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

a = pow(10, N, mod)
b = pow(9, N, mod)
c = pow(8, N, mod)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def inverse(self, k):
        """kの逆元を求める O(1)"""
        return (self.inv_fact[k] * self.fact[k - 1]) % self.MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD

    def combination2(self, k, r):
        """kCrを求める O(r)
        kが大きいが、r <= nを満たしているときに使用
        """
        if k < r:
            return 0
        res = 1
        for l in range(r):
            res *= (k - l)
            res %= self.MOD
        return (res * self.inv_fact[r]) % self.MOD

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

all_ = pow(10, n, MOD)
not09 = pow(8, n, MOD)

only0 = 0
for i in range(1, n + 1):
    only0 += comb.combination(n, i) * pow(8, n - i, MOD)
    only0 %= MOD
print((all_ - not09 - 2 * only0) % MOD)

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-b*2+c)%(10**9+7))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def pow_mod(x, y, mod=10**9 + 7):
    if y == 0:
        return 1
    res = 1
    for i in range(y.bit_length()):
        if y & (1 << i):
            res *= x
            res %= mod
        x *= x
        x %= mod
    return res


n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
mod=pow(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:
import sys
input = sys.stdin.readline
N = int(input())
if N == 1:
  print(0)
  exit(0)
mod = 10 ** 9 + 7
res = pow(10, N, mod) - pow(9, N, mod) * 2 + pow(8, N, mod)
print(res % mod)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

def main():
    N = int(input())
    if N == 1:
        print(0)
        return

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    MOD=10**9+7

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

    print(ans)




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    mod = 10**9+7
    tmp_all = 1
    tmp_not09 = 1
    tmp_not0 = 1
    tmp_not9 = 1
    for i in range(n):
        tmp_all *= 10
        tmp_not09 *= 8
        tmp_not0 *= 9
        tmp_not9 *= 9

        tmp_all %= mod
        tmp_not09 %= mod
        tmp_not0 %= mod
        tmp_not9 %= mod

    print((tmp_all + tmp_not09 - tmp_not0 - tmp_not9)%mod)

Submission status: Accepted

Solution code:
N = int(input())
waru = 10**9 + 7
ans = (10**N + 8**N - 2*(9**N))%waru
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=input()
c=0
f1=1;f2=1;f3=1
m=10**9+7
for i in range(n):
  f1*=10;f2*=9;f3*=8
  f1%=m;f2%=m;f3%=m
print (f1-2*f2+f3)%m

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
(N, ) = [int(n) for n in input().split()]

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

Submission status: Accepted

Solution code:
mod=10**9+7
n=int(input())
if n==1:print(0);exit()
ans=pow(10,n,mod)
anss=pow(9,n,mod)
ansss=pow(8,n,mod)
print((ans-anss*2+ansss)%mod)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    n=I()
    ans=pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)
    print(ans%mod)
    

        
        
        
        
    
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MODULO = 10**9 + 7

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

Submission status: Accepted

Solution code:
def main():

    N = int(input())
    mod = pow(10, 9) + 7

    if N == 1: return 0
    if N == 2: return 2

    v = 1
    for _ in range(N):
        v *= 8
        v %= mod
    u = 1
    for _ in range(N):
        u *= 9
        u %= mod
    w = 1
    for _ in range(N):
        w *= 10
        w %= mod

    a = w - (u-v) - (u-v) - v
    a %= mod
    return a




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

Submission status: Accepted

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

MODULUS = 10**9+7

N = int(input())

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

print((ret%MODULUS + MODULUS) % MODULUS)

Submission status: Accepted

Solution code:
def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
Mod=10**9+7
n=int(input())
print((power_func(10,n,Mod)-2*power_func(9,n,Mod)+power_func(8,n,Mod))%Mod)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    mod = 10**9+7
    dp = [1, 0, 0, 0]
    for i in range(n):
        dp2 = [0, 0, 0, 0]
        dp2[0] = (dp[0]*8) % mod
        dp2[1] = (dp[0]+dp[1]*9) % mod
        dp2[2] = (dp[0]+dp[2]*9) % mod
        dp2[3] = (dp[1]+dp[2]+dp[3]*10) % mod
        dp = dp2
    print(dp[3])


main()

Submission status: Accepted

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

Submission status: Accepted

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

print(dp[n][3])

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
def power(a,n):
  ans = 1
  while n:
    if n%2:
      ans = (ans*a)%mod
    a = (a*a)%mod
    n >>= 1
  return ans%mod  
s = power(10,n)
s -= 2*power(9,n)
s += power(8,n)
print(s%mod)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7


n = int(readline())

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())
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:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N = int(input())
ans = (10 ** N) % MOD - (9 ** N) * 2 % MOD + (8 ** N) % MOD
print(ans % MOD)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7

n = int(input())

ret = pow(10, n, MOD)
ret -= pow(9, n, MOD)
ret -= pow(9, n, MOD)
ret += pow(8, n, MOD)

print(ret % 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:
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

MOD = 1_000_000_007

def pow(a, b):
    ret = 1
    while b > 0:
        if (b & 1) == 1:
            ret = ret * a % MOD
        a = a * a % MOD
        b >>= 1
    return ret

def main():
    N = ri()
    ans = pow(10, N) - pow(9, N) - pow(9, N) + pow(8, N)
    ans %= MOD
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
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:
# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

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

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

al=pow(10,N,C)
nze=pow(9,N,C)
nzn=pow(8,N,C)
print((al-nze*2+nzn)%C)

Submission status: Accepted

Solution code:
N = int(input())
# 10^N - 2 * 9^N + 8^N
base = 10 ** 9 + 7
A = pow(10, N, base)
B = pow(9, N, base)
C = pow(8, N, base)

print( (A - 2*B + C) % base )

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

print(ans % mod)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n, = map(int,read().split())

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

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

ans = (a10 - 2*a9 + a8) % mod
print(ans)

Submission status: Accepted

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


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)
ans -= 2 * 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())
p = pow(10, N, mod)
q = pow( 9, N, mod)
r = pow( 8, N, mod)
print((p-q*2+r)%mod)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    ans = pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)
    print(ans%mod)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

print((ans + MOD) % MOD)

Submission status: Accepted

Solution code:
def power(x, n, mod):
    ans = 1
    while n > 0:
        if n % 2 == 1:
            ans = ans * x % mod
        n //= 2
        x = x * x % mod
    return ans

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

Submission status: Accepted

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

ans = 1
ans9 = 1
ans8 = 1

for i in range(N):
  ans = ans * 10 % MOD
  ans9 = ans9 * 9 % MOD
  ans8 = ans8 * 8 % MOD

print((ans - ans9 * 2 + ans8) % MOD)