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:
#-*-coding:utf-8-*-

import sys

def main():
    n = int(input())
    MOD = 10**9+7
    if n <= 1:
        print(0)
        exit()
    A = 10**n-8
    ans = pow(10, n, MOD) - pow(9, n, MOD) - 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) - ((pow(9, N, mod) * 2) - 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:
n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
mod=10**9+7
e=pow(8,n,mod)
f=pow(9,n,mod)

g=pow(10,n,mod)
print((g-2*f+e)%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    md = 10 ** 9 + 7
    ##0または9を使わない組み合わせ
    tmp1 = 9 ** n % md + 9 ** n % md - 8 ** n % md
    ans = 10 ** n - tmp1
    ans %= md
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = (pow(10, N, MOD) - pow(9, N, MOD) - pow(9, N, MOD) + pow(8, N, MOD)) % MOD
    print(ret)


if __name__ == '__main__':
    main()

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

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
inf = 1000000000 + 7
a=1; b=1;c=1
if n==2: ans=2
elif n==1: ans=0
elif n>2:
    for i in range(n):
        a = (10*a) % inf
        b = (9*b) % inf
        c = (8*c) % inf
    ans = int(a%inf - int(2*b)%inf + int(c)%inf)%inf
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mod = 10 ** 9 + 7


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


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

print(ans % mod)

Submission status: Accepted

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

if n < 2:
    ans = 0
elif n == 2:
    ans = 2
else:
    ans = (10 ** n % M) - (9 ** n % M) - (9 ** n % M) + (8 ** n % M)

print(ans % M)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a=1
b=1
c=1

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


n = int(input())

mod = 10**9 + 7
ans = 0
ans += 10**n % mod
ans -= 2*9**n % mod
ans += 8**n % mod

print(ans % mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    ans = pow(10, n, MOD)
    ans -= 2 * pow(9, n, MOD)
    ans += pow(8, n, MOD)
    print(ans % MOD)
resolve()

Submission status: Accepted

Solution code:
from sys import stdin

readline = stdin.buffer.readline
read = stdin.buffer.read
def i_input(): return int(input().rstrip())
def i_map(): return map(int, input().rstrip().split())
def i_list(): return list(i_map())

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

def f(n: int) -> int:
    """
    >>> f(1)
    0
    >>> f(2)
    2
    >>> f(869121)
    2511445
    """
    return (10 ** n - 9 ** n - 9 ** n + 8 ** n) % (10 ** 9 + 7)


if __name__ == '__main__':
    n = int(input())
    print(f(n))

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

Submission status: Accepted

Solution code:
a = int(input())
mod = 10**9 +7
cum =0
num =0
if a >1:
  num = 10**a - 9**a*2 + 8**a
  cum = num % mod
  print(cum)
  exit()
print(0)

Submission status: Accepted

Solution code:
# 整数の入力
N = int(input())
 
print((10 ** N - 2* 9 ** N + 8 ** N) % (10 ** 9 + 7))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

e = pow(8, N, mod)
f = pow(9, N, mod)
g = pow(10, N, mod)

# 全体 - (0を含まない + 9を含まない) + 0と9どちらも含まない
ans = (g - 2 * f + e) % mod
print(ans)

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

M = 10**9+7
n = inp()
if n == 1:
    print(0)
    exit()
ans = pow(10,n,M) - 2*pow(9,n,M) + pow(8,n,M) 
print(ans%M)

Submission status: Accepted

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

def pow_by_iter(a, x, p):
    acc = a
    for i in range(1, x):
        acc = (acc * a) % p
    return acc

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

Submission status: Accepted

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

x = 10**n%mod
y = 2*9**n%mod - 8**n%mod
print((x-y)%mod)

Submission status: Accepted

Solution code:
N = int(input())

def powmod(x, y):
    num = 1
    for i in range(y):
        num = num * x % (10**9+7)
    return num

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

Submission status: Accepted

Solution code:
N=int(input())
M=10**9+7
ans=1
m=1
for i in range(N):ans=(ans*10)%M
for i in range(N):m=(m*9)%M
ans-=(m*2)%M
m=1
for i in range(N):m=(m*8)%M
print((ans+m)%M)

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
import itertools
import math
from operator import mul
from functools import reduce

mod = 10 ** 9 + 7

n = I()
if n < 2:
    ans = 0
elif n == 2:
    ans = 2
else:
    ans = 0
    # 1．普通に10個からN個重複ありで選ぶ
    a = pow(10, n, mod)
    # ２．0と9をのぞいた9個からn個重複選ぶ
    b = pow(9, n, mod) * 2
    # ３．0と9を除いた8個からn個重複ありで選ぶ
    c = pow(8, n)
    # 0を除いた配列からn個選ぶ過程で、9が選ばれていない場合がある。
    # 逆に9を除いた配列からn個選ぶ過程で、0が選ばれてない場合がある。
    # 2回引くと、0も9も選ばれていない組み合わせが余計にひかれているので足しこむ。
    ans = (a-b+c) % mod

print(ans)

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:
def mypow(x,k,p):
    out = 1
    while(k > 0):
        if(k%2 == 1):
            out = out * x % p
        k = k // 2
        x *= x
    return out

p = 10 ** 9 + 7
n = int(input())
res = (mypow(10,n,p) - mypow(9,n,p)*2 + mypow(8,n,p)) % p
print(res)

Submission status: Accepted

Solution code:
n = int(input())

mod = (10**9)+7

if n == 1:
    print(0)
elif n==2:
    print(2)
else:
    t = (10**n)
    tmp = (9**n)
    non = (8**n)
    print((t+non-tmp*2)%mod)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math

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

df = (10 ** n) - (2 * 9 ** n - 8 ** n)

print(df % inf)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math

n = int(input())

ans = 0
MOD = 10**9 + 7
if (n == 2):
    ans = 2
elif (n < 2):
    ans = 0
else:
    ans = ((10 ** n) - (2 * 9**n) + 8**n) % MOD 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


def get_output(n):
    if n <= 1:
        return 0
    if n <= 2:
        return n
    return (10**n - 9**n - 9**n + 8**n) % 1000000007


print(get_output(N))

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

mod = pow(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:
"""
int(input())
map(int, input().split())
list(map(int, input().split()))
input()
input().split()
"""


n = int(input())
mod = 1000000007
tmp = (10**n)%mod
diff = 2*(9**n)%mod
eight = (8**n)%mod

ans = tmp - diff + eight
ans%=mod
print(ans)

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N = int(input())
mod =10**9 +7
ans =0
if N ==1:
    ans =0
elif N ==2:
    ans =2
else:
    ans =(10**N -9**N -9**N +8**N ) %mod
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())

mod=10**9+7
def mpow(x,n):
    return x**n % mod

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque

# 整数の入力
N = int(input())

U = 10 ** N
a = 2*9**N-8**N
ans = (U-a)%(10**9+7)
print(ans)

Submission status: Accepted

Solution code:
def pow_k(x, n,mod = 10**9+7):
    res = 1
    for i in range(0,n):
        res = res * x % mod

    return res

def solve(n,mod = 10**9+7):
    total = pow_k(10,n)
    not_include_0 = pow_k(9,n)
    not_include_9 = not_include_0
    not_include_0_and_9 = pow_k(8,n)
    return (total%mod-(not_include_0 + not_include_9 - not_include_0_and_9)%mod)%mod

def main():
    n = int(input())
    print(solve(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

MOD = 1000000007  # type: int


def solve(N: int):
    if N == 1:
        print(0)
        return
    if N == 2:
        print(2)
        return
    ans = (10 ** N) - ((9 ** N )* 2) + (8 ** N)
    print(ans % MOD)



    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
I=lambda:int(input())

n=I()
mod=10**9+7
tens=pow(10,n,mod)
nines=pow(9,n,mod)
eights=pow(8,n,mod)
ans=(tens-(nines*2-eights))%mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10**9+7

def powmod(x, y):
    a = 1
    for _ in range(y):
        a *= x
        a %= mod
    return a

# (0も9もある) = (全体) - (0がある/9がない) - (9がある/0がない) - (0も9もない)
ans = powmod(10, N) - powmod(9, N) - powmod(9, N) + powmod(8, N)
ans %= mod

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
# {A:数列に0だけ存在しない集合, B:数列に9だけ存在しない集合}
# 全体集合 - (A + B) + A and B 
ans = (10 ** N - 9 ** N * 2 + 8 ** N) % (10 ** 9 + 7) 
print(ans)

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().strip()

def main():
    def nCr(n,r):
        mod = 10 ** 9 + 7
        a = b = 1
        for i in range(r):
            a = (a * (n - i)) % mod
            b = (b * (r - i)) % mod
        return (a * pow(b,mod-2,mod))%mod

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
MOD = 10**9+7

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

Submission status: Accepted

Solution code:
n = int(input())
j = q = h = 1
rem = 10**9+7
for i in range(n):
    j *= 10
    j %= rem
    q *= 9
    q %= rem
    h *= 8
    h %= rem
print((j-q*2+h)%rem)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans=1
num=1
ans1=1
a=(10**9)+7
for i in range(N):
    ans*=10
    ans=ans%a
    num*=9
    num=num%a
    
for i in range(N):
    ans1*=8
    ans1=ans1%a


print((ans-2*num+ans1)%(10**9+7))

Submission status: Accepted

Solution code:
import sys
from sys import stdin,stdout
import math
import random
import heapq
from collections import Counter
from functools import lru_cache
#@lru_cache(maxsize=None) #for optimizing the execution time of callable objects/functions(placed above callable functions)
try:
    m=(10**9+7)
    for _ in range(1):
        n=int(input())
        if n==1:
            print(0)
        elif n==2:
            print(2)
        else:
            print((((pow(10,n,m)-(2*pow(9,n,m)))%m)+pow(8,n,m))%m)
            
            


    
except EOFError as e:
    print(e)

Submission status: Accepted

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input_int()
    MOD = (10 ** 9) + 7

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#C - Ubiquity
import math
N = int(input())
a = 10**9+7

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

# def combinations_count(n, r):
#     return math.factorial(n)%a // (math.factorial(n - r)%a * math.factorial(r))%a
#
# ans =(10**(N-2))%a*(combinations_count(N, 2)*2)%a-combinations_count(N, 2)%a
print(ans%a)

Submission status: Accepted

Solution code:
N = int(input())
div = 1000000007
a = N % div
a = a * (a-1) % div
a = pow(10, N) % div
b = pow(9, N) % div * 2 % div
c = pow(8, N)

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

Submission status: Accepted

Solution code:
def resolve():
  N = int(input())
  base = 10**9+7

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

  ten = pow(10, N, base)
  nine = pow(9, N, base) * 2
  eight = pow(8, N, base)

  print((ten - nine + eight)%base)

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input()) 
ans = 0

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

Submission status: Accepted

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

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

mod = (10**9) +7

ans=pow(10,n)

a=pow(9,n)
b=pow(8,n)

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

print(ans)

Submission status: Accepted

Solution code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
import itertools
import math
from operator import mul
from functools import reduce

mod = 10 ** 9 + 7

n = I()
if n < 2:
    ans = 0
elif n == 2:
    ans = 2
else:
    ans = 0
    a = pow(10, n, mod)
    b = pow(9, n, mod) * 2
    c = pow(8, n)
    ans = (a-b+c) % mod

print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
import bisect #二部探索
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化
mod = 10**9 + 7
INF = 10**9 + 7
from operator import mul
from functools import reduce

def main():
    n = int(input())    
    ans = (pow(10, n, mod=mod) -(pow(9, n, mod=mod) + pow(9, n, mod=mod) - pow(8, n, mod=mod))) % mod
    print(ans)
    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9+7
no1 = 1
no19 = 1
ans = 1
for i in range(N):
  no1*= 9
  no1 %= mod
  no19 *= 8
  no19 %= mod
  ans *= 10
  ans %= mod
print((ans - no1*2 + no19)%mod)

Submission status: Accepted

Solution code:
# 余事象と見れなかった時点で絶望的

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


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7
nn = 10 ** N
nm = (9 ** N) + (9 ** N) - (8 ** N)
a = (nn -nm) % mod
print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10**9+7

# 二分累積法による a^n mod の計算
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())
ans = modpow(10, N, MOD) - 2*modpow(9, N, MOD) + modpow(8, N, MOD)
print(ans%MOD)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from sys import stdin

    readline = stdin.readline

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

    result = (10 ** N - 9 ** N - 9 ** N + 8 ** N) % ( 10 ** 9 + 7 )

    print(result)

main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
        
    A = 1
    countA = 0
    for i in range(N):
        A = (A*10)%(10**9 + 7)
        
    B = 1
    countB = 0
    for i in range(N):
        B = (B*9)%(10**9 + 7)
        
    C = 1
    countC = 0
    for i in range(N):
        C = (C*8)%(10**9 + 7)
        
    ans = (A - 2*B + C)%(10**9 + 7)
        
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(0)
else:
    t = 10**9 + 7
    a = (10**n)
    b = (8**n)
    c = (9**n)

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

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:
import sys
def I(): return int(sys.stdin.readline().rstrip())


N = I()
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())
c10n = 1
c8n = 1
c9n = 1

mod = 10**9+7
for i in range(n):
    c10n *= 10
    c10n %= mod
for i in range(n):
    c8n *= 8
    c8n %= mod
for i in range(n):
    c9n *= 9
    c9n %= mod

ans = (c10n - c9n)*2 - (c10n - c8n)
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:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    num = 10**9 + 7
    if n == 1:
        print(0)
    else:
        ans = 10**n -2*9**n + 8**n
        ans %= num
        print(ans)
main()

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

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

Submission status: Accepted

Solution code:
# Date [ 2020-09-13 21:05:36 ]
# Problem [ c.py ]
# Author Koki_tkg

import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

class Combination:
    def __init__(self, n, p):
        self.n = n
        self.p = p
        self.note = [1, 1]
        self.noteinv = [1, 1]
        self.inv = [0, 1]
        self.calc()

    def calc(self):
        for i in range(2, self.n + 1):
            self.note.append((self.note[-1] * i) % self.p)
            self.inv.append((-self.inv[self.p % i] * (self.p // i)) % self.p)
            self.noteinv.append((self.noteinv[-1] * self.inv[-1]) % self.p)
    
    def nCr(self, n, r):
        n = self.n
        if r < 0 or n < r:
            return 0
        r = min(r, n - r)
        return (self.note[n] * self.noteinv[r] * self.noteinv[n - r]) % self.p


def Main():
    n = read_int()
    if n == 1:
        print(0)
        exit()
    elif n == 2:
        print(2)
        exit()
    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 -*-

n = int(input())

x = 10 ** 9 + 7

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

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

print(ans % x)

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
from operator import mul
from functools import reduce

mod = 1000000007
N = I()

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
MOD = 1000000000 + 7
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
print(str((power_func(10, N, MOD) - 2 * power_func(9, N, MOD) + power_func(8, N, MOD)) % MOD))

Submission status: Accepted

Solution code:
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N = int(input())

answer = 0
rest = 10 ** 9 + 7
if N == 1:
  answer = 0
else:
  answer = (10 ** N) - (9 ** N) - (9 ** N) + (8 ** N)
print(answer % rest)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from sys import stdin

N = int(input())
MOD = 1000000007

def solve(N):
    res=1
    zn=1
    zz=1
    zo=1
    for i in range(N):
        res=(res*10)%MOD
    for i in range(N):
        zn=(zn*9)%MOD
    for i in range(N):
        zz=(zz*9)%MOD
    for i in range(N):
        zo=(zo*8)%MOD
    zx = ((zz + zn)%MOD - zo) % MOD
    return (res-zx)%MOD

if(N<2):print(0)
else: print(solve(N))