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:
import sys
import math

mod = 10 ** 9 + 7

N = int(input())

if N <= 1:
    print(0)
    sys.exit()

# ans = comb(N, 2, exact=True) * 2 * (8 ** (N - 2)) + (9 ** N - 8 ** N) * 2
ans = 10 ** N - 8 ** N - (9 ** N - 8 ** N) * 2
print(ans % mod)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  a = 1
  b = 1
  c = 1
  mod = (10 ** 9) + 7
  for _ in range(N):
    a = (a * 10) % mod
    b = (b * 9) % mod
    c = (c * 8) % mod
  print((a - (2*b) + c) % mod )
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)
import itertools as it
import collections as cl
from collections import deque
import math
from functools import reduce
from collections import defaultdict
D = 10 ** 9 + 7

def li():
    return [int(x) for x in input().split()]


def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

N = int(input())

total = modpow(10, N, D)
A = total - modpow(9, N, D)
B = total - modpow(9, N, D)
C = total - modpow(8, N, D)

ans = (A + B - C) % D
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
m = 1000000007
if N == 1:
    print(0)
else:
    print((pow(10,N,m)-pow(9,N,m)-pow(9,N,m)+pow(8,N,m))%m)

Submission status: Accepted

Solution code:
N = int(input())


def add(a, b, BIGMOD):
    return (a + b) % BIGMOD


def sub(a, b, BIGMOD):
    return (a - b + BIGMOD) % BIGMOD


MOD = 10 ** 9 + 7

D = pow(10, N, MOD)
C = pow(8, N, MOD)
A = pow(9, N, MOD)
B = A

print(sub(D,sub(add(A,B,MOD),C,MOD),MOD))

Submission status: Accepted

Solution code:
# by the authority of GOD
import os,sys
from io import BytesIO, IOBase

def main():
    mod=10**9+7
    n= int(input())
    if n==1:
        print(0)
    elif n==2:
        print(2)
    else:
        print(((pow(10,n,mod)+pow(8,(n),mod))%mod - (pow(9,n)*2)%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

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

def factorial(p, n):
    result = 1
    for i in range(1, n + 1):
        result = result * p % mod
    return result

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

while True:
    if ans > 0:
        break
    ans += mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if n == 1:
    print(0)
    exit()
    
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
res = 2 * (pow(10, n, mod) - pow(9, n, mod)) - (pow(10, n, mod) - pow(8, n, mod))
res %= mod
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
x=10**N
y=9**N
z=8**N
p=x-2*y+z
MOD=10**9+7

print(p%MOD)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=int(1e9)+7

###############################################################################\n=17
def power(a,n):
    res=1
    while(n):
        if n&1:
            res=res*a
        a=a*a
        n//=2
        res%=J
        a%=J
    return res%J
n=int(input())
x=power(10,n)-2*power(9,n)+power(8,n)
print(x%J)

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:
import itertools

n = int(input())

matrix = 10**n

matrix_0 = 9**n

matrix_0_9 = 8**n

ans = matrix-(matrix_0*2-matrix_0_9)

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

mod = 10**9+7
# m**n
def modpow(m,n,mod=1000000007):
    res = 1
    while n>0:
        if n&1: res = res * m % mod
        m = m * m % mod
        n >>= 1
    return res

n = ii()

b = modpow(10,n)
s = modpow(8,n)
m = modpow(9,n)

ans = b - s - 2*(m-s)

print(ans%mod)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union
# import time
# import math, cmath
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import _heapify_max, _heappop_max, _siftdown_max
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)



def main():
    Num = Union[int, float]
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input():  return sys.stdin.readline().rstrip()
    def ii():     return int(input())
    def isp():    return input().split()
    def mi():     return map(int, input().split())
    def mi_0():   return map(lambda x: int(x)-1, input().split())
    def lmi():    return list(map(int, input().split()))
    def lmi_0():  return list(map(lambda x: int(x)-1, input().split()))
    def li():     return list(input())
    def debug(x): print(x, file=sys.stderr)
    # def _heappush_max(h, item): h.append(item); _siftdown_max(h, 0, len(h)-1)
    
    
    n = ii()
    res = 2 * pow(9, n, mod) - pow(8, n, mod)    # no 0 or no 9
    print((pow(10, n, mod) - res) % mod)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
result=10**N-8**N-2*(9**N-8**N)
print(result%(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:
#from scipy.special import comb
def ge():
    return map(int,input().split())
def main():
    #a,b,c,d=ge()
    #a=list(map(int,input().split()))
    #a=input()
    N=int(input())
    if N==1:
        print(0)
    #elif N==2:
        #print(2)
    else:
        #comb(N, 1, exact=True)
        #ans=N*(N-1)*(10**(N-2))
        ans=10**N-(9**N)*2+8**N
        print(ans%(10**9+7))
    #comb(4, 2, exact=True)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
if n==1:exit(print(0))
m=10**9+7
total=pow(10,n,m)
total=(total-pow(9,n,m))%m # without zeros
total=(total-pow(9,n,m))%m # without ones
total=(total+pow(8,n,m))%m # without zeros and ones
print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    MOD = int(10**9+7)
    N = int(input())
    total = 1
    not0 = 1
    not9 = 1
    not09 = 1
    for _ in range(N):
        total *= 10
        total %= MOD
        not0 *= 9
        not0 %= MOD
        not9 *= 9
        not9 %= MOD
        not09 *= 8
        not09 %= MOD
    
    ans = total - not0 - not9 + not09
    while ans < 0:
        ans += MOD
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
mod = 10**9 + 7
def main():
  n = int(input())
  ans_every = 1
  ans_0 = 1
  ans_0_9 =  1
  for i in range(n):
    ans_every *= 10
    ans_every %= mod
    
    ans_0 *= 9
    ans_0 %= mod
    
    ans_0_9 *= 8
    ans_0_9 %= mod
  print((ans_every-(ans_0*2 -ans_0_9))%mod)
  
if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
import math
import re
#import sympy

#a,b,c,d=map(int,input().split())



war=10**9+7

a=int(input())
if a<2:
    print(0)
    exit()

print((10**a-9**a-9**a+8**a)%war)

Submission status: Accepted

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

if N==1:
    ans = 0
else:
    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())

def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

p = 1000000007
Z = power_func(10,N,p)
print(((Z - power_func(9,N,p))*2 - Z+power_func(8,N,p))%p)

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

if N==1:
    print(0)
elif N==2:
    print(2)
else:
    a=(10**(N))
    b1=(9**(N))
    b2 = (8 ** (N))
    c=(a-2*b1+b2)%(10**9+7)
    print(int(c))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=1
b=1
c=1
d=1000000007
if n==1:
  print(0)
elif n==2:
  print(2)
else:
  for i in range(n):
    a=(a*10)%d
    b=(b*9)%d
    c=(c*8)%d
  ans=(a+c-2*b)%d
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans1=1 
ans2=1
ans3=1

mod = 1000000007

for i in range(n):
    ans1 = (ans1*10)%mod
    
for i in range(n):
    ans2 = (ans2*9)%mod

for i in range(n):
    ans3 = (ans3*8)%mod

print((ans1-2*ans2+ans3)%mod)

Submission status: Accepted

Solution code:
def main():
    # start coding here...
    N = int(input())
    mod = 10**9 + 7
    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())
print(((10**N) - (2 * (9**N) - (8**N))) % ((10**9) + 7))

Submission status: Accepted

Solution code:
N = int(input())

c10 = 10
c9 = 2*9
c8 = 8

BIG_M = 10**9+7

for i in range(N-1):
    c10 = (c10*10)%BIG_M
    c9 = (c9*9)%BIG_M
    c8 = (c8*8)%BIG_M
    
print((c10 - c9 + c8)%BIG_M)

Submission status: Accepted

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

Submission status: Accepted

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

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())
ten = 1
eight = 1
nine = 1
for i in range(n):
    ten *= 10
    ten = ten%(10**9 + 7)
    eight *= 8
    eight = eight%(10**9 + 7)
    nine *= 9
    nine = nine%(10**9 + 7)
print((ten+eight-(2*nine))%(10**9 + 7))

Submission status: Accepted

Solution code:
n = int(input())
o = 10**n
m = 9**n
p = 8**n
ans = (o-2*m+p) % (10**9+7)
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:
import sys
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
from collections import deque 

input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _dbg(o):
    print(o, file=sys.stderr)

# ---------------------------------------

N = inp()
mod = 10**9 + 7
_dbg(mod)

a = 1
b = 1
c = 1
for _ 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:
def solve():
    N = int(input())
    MOD = 10**9+7
    U = pow(10,N,MOD)
    inc_zero = U - pow(9,N,MOD)
    inc_nine = inc_zero

    inc_both = U - pow(8,N,MOD)

    print((inc_zero+inc_nine-inc_both) % MOD)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
mod = 1000000007

N = int(input())

a = 1
for i in range(N):
    a = (a * 10) % mod

b = 2
for i in range(N):
    b = (b * 9) % mod

c = 1
for i in range(N):
    c = (c * 8) % mod

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

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*(n>1))

Submission status: Accepted

Solution code:
mod = 1000000007

n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

if N==1:
    print(0)
elif N ==2:
    print(2)
else:
    ans2 = 0
    ans1 = 2
    ans0 = 8
    
    for i in range(N-1):
        ans2 = ans2*10 + ans1*1
        ans1 = ans1*9 + ans0*2
        ans0 = ans0*8
        ans2 %= mod
        ans1 %= mod
        ans0 %= mod
        
    print(ans2)

Submission status: Accepted

Solution code:
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a = 1
b = 1
c = 1
m = 10**9 + 7

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

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

Submission status: Accepted

Solution code:
N=int(input())
#0~9`がない→(１〜9)or(0~8)
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 - 9**N - 9**N + 8**N
print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#one, two, three, four, five = map(int, input().split())
#li = list(map(int, input().split()))
N=int(input())
print((10**N-2*(9**N)+8**N)%(10**9+7))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]
#CW = [list(map(int, list(input()))) for _ in range(H)]


N = int(input())
mod = 10**9+7
ans = 0
ten = 1
nine = 1
eight = 1

for i in range(N):
  ten = (10*ten)%mod
  nine = (9*nine)%mod
  eight = (8*eight)%mod

neight = 2*nine - eight

if(neight<0):
  neight += mod

ans = ten - neight

if(ans<0):
  ans += mod

print(ans%mod)

Submission status: Accepted

Solution code:
N=int(input())

k=10**9+7
def njou(x,n):

    ans=1
    for i in range(n):
        ans=ans*x
        if ans>k:
            ans=ans%k
    return(int(ans))
print((njou(10,N)+njou(8,N)-2*njou(9,N))%k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

m = (10**9)+7

print(((10**N)%m-(8**N)%m-((9**N)%m-(8**N))*2%m)%m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
if n==1:
	print(0)
	exit()
mod = 10**9+7
a = pow(10,n,mod)
b = pow(8,n,mod)
c = pow(9,n,mod)
print((a-2*c+b)%mod)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * \
                modinv[self.mod % i] % self.mod
        return modinv


MOD = 10 ** 9 + 7


def main():
    N = II()

    if N == 1:
        print(0)
        return
    if N == 2:
        print(2)
        return

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

    print(ans)


main()

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    return n

def main(n):
    MOD=10**9+7
    ans=pow(10,n,MOD)-pow(9,n,MOD)-pow(9,n,MOD)+pow(8,n,MOD)
    ans=(ans+MOD)%MOD
    return ans

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################
    
def solve():
    n = inp()
    print((pow(10,n,1000000007) - pow(9,n,1000000007) - pow(9,n,1000000007) + pow(8,n,1000000007)) % 1000000007)
    
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)

def counter_elements(a):
    q = dict()
    for i in range(len(a)):
        if a[i] not in q:
            q[a[i]] = 0
        q[a[i]] = q[a[i]] + 1
    return(q)

def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)
 
def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))
 
def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

def transpose(a):
    n,m = len(a),len(a[0])
    b = [[0] * n for i in range(m)]
    for i in range(m): 
        for j in range(n): 
            b[i][j] = a[j][i]
    return(b)

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    mod = 10 ** 9 + 7

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

    print(res)



main()

Submission status: Accepted

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

def f(a,n):
	mod = (10 ** 9 )+ 7
	
	if n == 0:
		return 1
	t = f(a,n/2) % mod
	return ((t ** 2) * (a if n%2 else 1)) %mod

print (f(10,n) - f(9,n) - f(9,n) + f(8,n)) %mod