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:
# your code goes here
from sys import stdin,stdout

n = int(stdin.readline())
mod = 1000000007
val = ((((pow(10,n,mod) - pow(9,n,mod))+mod)%mod -pow(9,n,mod) + mod)%mod + pow(8,n,mod))%mod
stdout.write(str(val))

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())
M = 10**9+7
Uset = 1
Aset = 1
Bset = 1
Cset= 1
for _ in range(N):
    Uset = (Uset*10)%M
    Aset = (Aset*9)%M
    Bset = (Aset*9)%M
    Cset = (Cset*8)%M
print((Cset+Uset-2*Aset)%M)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10**9+7

n = int(input())

ans = 1
for i in range(n):
    ans = ans*10%MOD

minus = 1
minus2 = 1
for i in range(n):
    minus = minus*8%MOD
    minus2 = minus2*9%MOD
    
print((ans-2*minus2+minus)%MOD)

Submission status: Accepted

Solution code:
n = int(input())
con = 1;
a = 1;
b = 1;

for i1 in range(n):
    con = (con * 10) % 1000000007;
for i2 in range(n):
    a = (a * 9) % 1000000007;
for i3 in range(n):
    b = (b * 8) % 1000000007;

c = (2*a - b)%1000000007;
con = (con - c)%1000000007;
print(con)

Submission status: Accepted

Solution code:
N=int(input())
if N==1:
    print(0)
    exit()

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p) 階乗のmod
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

ans=0
# otherの数
for i in range(0,N-1):
    # 0 or 9
    num09=N-i
    now=cmb(N, N-i,p)*(pow(2,N-i,p)-2)*pow(8,i,p)%p
    ans+=now
    ans%=p

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    if n == 1:
        ans = 0
    else:
        mod = pow(10, 9)+7
        ans = (mod + pow(10, n, mod) + pow(8, n, mod) - 2*pow(9, n, mod)) % mod
    print(ans)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

n = ii()

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

Submission status: Accepted

Solution code:
N = int(input())
MOD = 10**9 + 7
def f(x, y): return pow(x, y, MOD)
print((f(10, N) - f(9, N) - f(9, N) + f(8, N) + MOD) % MOD)

Submission status: Accepted

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
if n<1:
    print(0)
    exit()

zero=pow(10,n,mod)-pow(9,n,mod)
nine=pow(10,n,mod)-pow(9,n,mod)
ans=zero+nine-(pow(10,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())

if N < 2:
    print(0)
    exit()
if N == 2:
    print(2)
    exit()
mod = 10**9 +7
ans = pow(10,N,mod)+pow(8,N,mod)-pow(9,N,mod)*2
ans %= mod
print(ans)

Submission status: Accepted

Solution code:
mod = 10**9+7
N = int(input())
if N == 1:
    print(0)
    exit()
plus = 1
minus = 1
cap = 1
for _ in range(N):
    plus *= 10
    minus *= 9
    cap *= 8
    plus %= mod
    minus %= mod
    cap %= mod
print((plus-2*minus+cap)%mod)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9+7
x = 1
y = 1
z = 1
for i in range(N):
    x *= 9
    y *= 8
    z *= 10
    x %= mod
    y %= mod
    z %= mod
x *= 2
ans = z - x + y
print(ans%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)
ans = a-2*b+c
ans %= mod
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(a)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = 10 ** N - 9 ** N - 9 ** N + 8 ** N
print(a % mod)
# 9 ** (N)
# ans = N * (N - 1) * 10 ** (N)
# print(ans % mod)
# a = 8 ** N
# b = 10 ** N
# ans = (b - a) % mod
# print(ans)

Submission status: Accepted

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

ten = [10]
nine = [9]
eight = [8]
for i in range(20):
    ten.append(ten[-1] ** 2 % mod)
    nine.append(nine[-1] ** 2 % mod)
    eight.append(eight[-1] ** 2 % mod)
ans = 0
num = bin(n)[2:]
temp10 = 1
temp9 = 2
temp8 = 1
for i in range(len(num)):
    if num[-i-1] == "1":
        temp10 *= ten[i]
        temp10 %= mod
        temp9 *= nine[i]
        temp9 %= mod
        temp8 *= eight[i]
        temp8 %= mod
ans = ans + temp10 - temp9 + temp8
ans %= mod
print(ans)

Submission status: Accepted

Solution code:
"""
方針
Uを求める(u)
0を含まないA(a)
9を含まないB(b=a)
AかつB(c)

ans = U - (2*a -c)
"""
n=int(input())
p=10**9+7
u=1

def clock(v, cnt):
  ret = 1
  for i in range(cnt):
    ret = (ret * v) % p
  return ret

u = clock(10, n)
a = clock(9, n)
c = clock(8, n)
ans = (u - (2*a - c))%p
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

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

Submission status: Accepted

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

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())
if n==1:
    print(0)
    exit()
no09=8**n
no0=9**n
print((10**n-9**n-(no0-no09))%(10**9+7))

Submission status: Accepted

Solution code:
n=int(input())


# ==================================================-
# modを考慮したべき乗
# a**n%modを高速に出力
def power_func(a, n, mod=10 ** 9 + 7):
    bi = str(format(n, "b"))
    res = 1
    for i in range(len(bi)):
        res = (res * res) % mod
        if bi[i] == "1":
            res = (res * a) % mod
    return res

mod=10**9+7
all_situation=power_func(10,n)

non_zero_situation=power_func(9,n)

non_nine_situation=power_func(9,n)

non_zero_and_nine_situation=power_func(8,n)

answer=(all_situation-non_zero_situation-non_nine_situation+non_zero_and_nine_situation)%mod
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
total = 10**n
a1 = 9**n
a2 = 9**n
a12 = 8**n

ans = (total - a1 - a2 + a12) % (10**9 + 7)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    n = int(input())
    ans = (10 ** n - 2 * (9 ** n) + 8 ** n) % (10 ** 9 + 7)
    print(ans)
    
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)
print(ans%MOD)

Submission status: Accepted

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

##0も9もない
temp = pow(8, n, p)

#0がない
tempp = pow(9,n,p)

#全体
temppp = pow(10,n,p)
    
res = (temppp-tempp*2 + temp) % p

print(res)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

limit = 1000000007

def calc(k, n):
    a = 1

    for i in range(n):
        a *= k
        a = a % limit
    return a

X = calc(10, N) + calc(8, N) - 2 * calc(9, N)
X = X % limit

print(X)

Submission status: Accepted

Solution code:
n=int(input())

mod=10**9+7

def power_func(a,n,mod):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res)%mod
    if bi[i]=='1':
      res=(res*a)%mod
  return res

x=power_func(10,n,mod)
y=power_func(9,n,mod)
z=power_func(8,n,mod)

ans=(x-(y-z)*2-z)%mod

print(ans)

Submission status: Accepted

Solution code:
mod = 10**9+7

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
N = int(input())

mymod = 1000000007

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

Submission status: Accepted

Solution code:
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    n=int(input())
    MOD=10**9+7
    dp=[[0]*4 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[n][3])

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
def main():
    n = int(input())

    mod = 10**9 + 7

    # すべての組み合わせから、いずれかの条件を満たさないパターンを引く

    pattern = 10 ** n
    not_pattern = (9 ** n) + (9 ** n) - (8 ** n)

    answer = (pattern - not_pattern) % mod

    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n = getN()
    a1 = pow(10, n, MOD)
    a2 = pow(8, n, MOD)
    a3 = pow(9, n, MOD) - a2
    # print(a1, a2, a3)
    print((a1 - 2 * a3 - a2) % MOD)

def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

Solution code:
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

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

# ------------------- fast io --------------------
from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    n = int(input())
    #n, k = map(int, input().split())
    #c, d = map(int, input().split())
    #a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    #s = input()
    if n == 1:
        print(0)
        continue

    a = [1, 27, 487]
    while len(a) <= n:
        a += [(27*a[-1]-242*a[-2]+720*a[-3])%(10**9+7)]
    print((a[-3]*2)%(10**9+7))

Submission status: Accepted

Solution code:
def main():

    n = int(input())

    if n ==1:
        print(0)
        return
    if n ==2:
        print(2)
        return
    m = (10 ** 9) + 7
    ans = (10 ** n) % m
    ans -= (8**n) %m
    ans -= ((9**n-8**n)*2)%m
    print(ans%m)
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
print((10**n-2*(9**n)+(8**n))%mod)

Submission status: Accepted

Solution code:
n=int(input())

all = 10 ** n
exit_2 = 9 ** n
exit_9 = 9 ** n
exit_2_9 = 8 ** n

ans = (all - (exit_2 + exit_9 - exit_2_9)) % (10**9 + 7)

print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
MOD = 10 ** 9 + 7
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
MOD = 10**9+7
all_cnt = pow(10, n, MOD)
not_a = pow(9, n, MOD)
not_b = pow(9, n, MOD)
not_a_b = pow(8, n, MOD)
res = (not_a + not_b - not_a_b) % MOD
ans = (all_cnt - res) % MOD
print(ans)

Submission status: Accepted

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


M = 10 ** 9 + 7


def compute(n):
    return (pow(10, n, M) - 2 * pow(9, n, M) + pow(8, n, M)) % M


def main():
    n = int(input())
    res = compute(n)
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    x = 10 ** 9 + 7
    
    kosuu = 10 ** n   - 9 ** n  - 9 ** n   + 8 ** n
    print(kosuu % x)


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
MOD = 10**9+7
ans = pow(10,N,MOD)
ans += pow(8,N,MOD)
ans -= pow(9,N,MOD)
ans -= pow(9,N,MOD)
ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
def pow(a, b, mod):
    result = 1
    while b:
        if b&1: result = (result * a) %mod
        a = (a * a) % mod
        b >>= 1
    return result

n = int(input())
if n <= 1:
    print(0)

else:

    mod = 10 ** 9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    N=int(sys.stdin.readline())
    if N==1:
        print(0)
        return
    m=10**9+7
    res=pow(10,N,m)-(2*pow(9,N,m)-pow(8,N,m))%m
    if res<0:
        print(res+m)
    else:
        print(res%m)

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# AtCoder用のライブラリ
# 参照
# https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a


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


N = int(input())

ALL = mod_pow(10, N)
side = mod_pow(9, N)
none = mod_pow(8, N)

MOD = 10 ** 9 + 7

print((ALL - side * 2 + none) % MOD)

Submission status: Accepted

Solution code:
import sys
from collections import deque
from functools import lru_cache
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


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

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


if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(N):
    nn, pn, np, pp = [8, 1, 1, 0]
    for i in range(N - 1):
        pp = (pp * 10 + np + pn) % MOD
        pn = (pn * 9 + nn) % MOD
        np = (np * 9 + nn) % MOD
        nn = (nn * 8) % MOD

    return pp


def main():
    # parse input
    N = int(input())
    print(solve(N))


# tests
T1 = """
2
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
2
"""

T2 = """
1
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
0
"""

T3 = """
869121
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
2511445
"""

T4 = """
3
"""
TEST_T4 = """
>>> as_input(T4)
>>> main()
54
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g, name=k)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

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)
ans %= MOD

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

MOD = 10**9 + 7

allp = pow(10,n,MOD)
not09 = 2*pow(9,n,MOD)
closs = pow(8,n,MOD)

print((allp - not09 + closs)%MOD)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input().rstrip('\n'))
res = 10**N-(9**N)*2 + 8**N
print(res % 1000000007)

Submission status: Accepted

Solution code:
def LI():return list(map(int,input().split()))
def II():return int(input())
def yes():return print("Yes")
def no():return print("No")
INF=float("inf")
from collections import deque, defaultdict, Counter
from heapq import heappop, heappush
from itertools import product, combinations
from functools import reduce, lru_cache
from math import pi, gcd
from decimal import Decimal

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

class Unionfind:
    def __init__(self, N):
        self.p = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def root(self, x):
        if self.p[x] != x:
            self.p[x] = self.root(self.p[x])

        return self.p[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        u = self.root(x)
        v = self.root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
            self.size[v] += self.size[u]
            self.size[u] = 0
        else:
            self.p[v] = u
            self.size[u] += self.size[v]
            self.size[v] = 0

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

    def count(self, x):
        return self.size[self.root(x)]

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

Submission status: Accepted

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

Submission status: Accepted

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

i = ((9**N - 8**N) * 2)%MOD
j = (10**N - 8**N)%MOD

print((j-i)%MOD)

Submission status: Accepted

Solution code:
N = int(input())

m = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
import math
import pprint
import fractions
import collections
import itertools
from decimal import *
from collections import deque
from bisect import *
N=int(input())
p=10**9+7
print((pow(10,N,p)+pow(8,N,p)-pow(9,N,p)-pow(9,N,p))%p)

Submission status: Accepted

Solution code:
N=int(input())

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

print(ans%1000000007)

Submission status: Accepted

Solution code:
## coding: UTF-8

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

#print(-3%mod)


ten = 1
nine = 1
eight = 1

if(N == 1):
    print(0)
else:
    for i in range(N):
        ten *= 10 
        ten %= mod
        nine *= 9
        nine %= mod
        eight *= 8
        eight %= mod
        ret = ten + eight - 2* nine
    print(ret % mod)

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 全て - 存在しない（1 ~ 8)まででできる
N = getN()
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())

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

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:
# -*- coding: utf-8 -*-
n = int(input())
ans = (10**n - 9**n - 9**n + 8**n ) % (10**9+7)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

MOD = 10 ** 9 + 7

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

print(ans)