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:
def main():
    examC()

def examA():
    N = I()
    ans = 1^N
    print(ans)
    return

def examB():
    a, b, c, d = LI()
    ans = max(a*c,a*d,b*c,b*d)
    print(ans)
    return

def examC():
    N = I()
    if N==1:
        ans = 0
    else:
        ans = pow(10,N,mod) - pow(9,N,mod)*2 + pow(8,N,mod)
        ans += mod*2
        ans %= mod
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

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





if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
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:
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

N=intput()
if N==1:
    print(0)
    exit()
if N==2:
    print(2)
    exit()
ans=powmod(10,N,MOD)-2*powmod(9,N,MOD)+powmod(8,N,MOD)
ans%=MOD
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(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())
if N==1:
  print(0)
  exit()
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:
def main():
    N = int(input())
    mod = 10 ** 9 + 7
    return (pow(10, N, mod) - pow(9, N, mod) - pow(9, N, mod) + pow(8, N, mod)) % mod

print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10**9 + 7
import sys
input = sys.stdin.readline
N = int(input())

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

Submission status: Accepted

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

for i in range(n):
    a*=10
    a%=m
    b*=9
    b%=m
    c*=8
    c%=m
ans = a-2*b+c+2*m
ans%=m
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mod = 1000000007

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

'''
Author: andyli
Time: 2020-09-13 19:58:05
'''

import os
from io import BytesIO, IOBase
import sys


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


# region fastio
BUFSIZE = 1048576


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)
def input(): return sys.stdin.readline().rstrip('\r\n')

# endregion


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
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 TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10**6#float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()

ans = pow(10, N, mod)
tmp1 = pow(9, N, mod)
tmp2 = pow(8, N, mod)

print((ans-2*tmp1+tmp2)%mod)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 10**9+7
n = int(input())
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())
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:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    dp = [[0] * (N+1) for _ in range(4)]
    dp[0][0] = 1
    for i in range(N):
        dp[0][i+1] = (dp[0][i] * 8)%mod
        dp[1][i+1] = (dp[0][i] + (dp[1][i] * 9)%mod)%mod
        dp[2][i+1] = (dp[0][i] + (dp[2][i] * 9)%mod)%mod
        dp[3][i+1] = ((dp[1][i] + dp[2][i])%mod + (dp[3][i] * 10)%mod)%mod
    print(dp[3][-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

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

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache

#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


#####Shorten#####
def DD(arg): return defaultdict(arg)

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b: a, b = b, a % b
    return a

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

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

N = I()

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

Submission status: Accepted

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

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)

print(res%mod)

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

MOD = 10**9 + 7

N = int(readline())

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

Submission status: Accepted

Solution code:
n=int(input())
mod1,mod2=10**9+7,998244353
mod=mod1

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

Submission status: Accepted

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

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

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

main()

Submission status: Accepted

Solution code:

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

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

Submission status: Runtime Error

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
import numpy as np
import random
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



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

Submission status: Runtime Error

Solution code:
n = int(input())

MOD = 10**9 + 7

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

#負の処理
ans (ans+MOD)%MOD

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
MOD=10**9+7
MAX=N+1
powerls=[0 for i in range(MAX)]
powerls[0]=1
powerls[1]=base                     
def powermod(ind):
  if powerls[ind]!=0:
    return powerls[ind]
  elif ind%2==0:
    p=(powermod(base,ind//2)**2)%MOD
    powerls[ind]=p
    return p
  else:
    p=((powermod(base,ind//2)**2)*base)%MOD     
    powerls[ind]=p
    return p

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

Submission status: Runtime Error

Solution code:
return N*(N-1)*9**(N-2) % (10**9 + 7)

Submission status: Runtime Error

Solution code:
from itertools import combinations

if __name__=="__main__":
  N=int(input())
  if N<2:
    print(0)
  else:
    print(combinations(N,2)%(10**9+7))

Submission status: Runtime Error

Solution code:
from itertools import combinations

if __name__=="__main__":
  N=int(input())
  if N<2:
    print(0)
  else:
    combinations(N,2)%(10**9+7)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
ans1 = 1
ans2 = 1
mod = 1000000007
for i in range(n):
	ans = (ans*10)%mod
    ans2 = (ans2*8)%mod
	ans1 = (ans1*9)%mod
ans = (ans - ans1 + mod)%mod
ans = (ans - ans1 + mod)%mod
ans = (ans + ans2)%mod
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 1
ans2 = 1
mod = 1000000007
for i in range(n):
	ans = (ans*10)%mod
    ans2 = (ans2*8)%mod
ans = (ans - ans2 + mod)%mod
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = r()
tens=1
nines=1
eights=1
mod = 10**9+7
for i in range(n):
    tens=(tens*10)%mod
    nines=(nines*9)%mod
    eights=(eights*8)%mod
print((tens-2*nines+eights)%mod)

Submission status: Runtime Error

Solution code:
from functools import reduce

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


def powmod(val, n, mod):
    # vals = [val]*n
    # ret = reduce(lambda x, y: x * y % mod, vals)

    # return ret

    for i in range(n):
        ret = ret * val % mod

    return ret


all = powmod(10, N, mod)
b = powmod(9, N, mod)
c = powmod(8, N, mod)

ans = (all - (2*b - c))%mod

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
print(10**n=9**n-8**n-9**n)

Submission status: Runtime Error

Solution code:
n=int(input())

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

Submission status: Runtime Error

Solution code:
mod = 10**9+7
N = int(input())
ans = (pow(a,N,mod) - 2*pow(b, N, mod) + pow(c, N, mod))%mod
if ans < 0:
    ans += mod
print(ans)

Submission status: Runtime Error

Solution code:
import math

N=int(input())

ku=math.factorial(N)

if N==1:
    kekka=0
elif N==2:
    kekka=ku
else:
    kekka=(ku/2*10^(N-2))%1000000007


print(kekka)

Submission status: Runtime Error

Solution code:
import math

N=int(input())

ku=math.factorial(5)

if N==1:
    kekka=0
elif N==2:
    kekka=ku
else:
    kekka=(ku/2*10^(N-2))%1000000007


print(kekka)

Submission status: Runtime Error

Solution code:
import math

N=int(input())

print(N)
ku=math.factorial(5)
print(ku)

if N==1:
    kekka=0
elif N==2:
    kekka=ku
else:
    kekka=(ku/2*10^(N-2))%1000000007


print(kekka)

Submission status: Runtime Error

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

main()

Submission status: Runtime Error

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: Runtime Error

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

Submission status: Runtime Error

Solution code:
print(10 ** int(input()) - 2 * 9 ** int(input()) + 8 ** int(input()))

Submission status: Runtime Error

Solution code:
# AtCoder Beginner Contest 178
# C - Ubiquity
import math

N=int(input())

mod=10**9+7

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

Submission status: Runtime Error

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

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

# 再帰だとなんか通らん
# dp = {}
# def rec(i, zero, nine):
#     if (i, zero, nine) in dp:
#         return dp[(i, zero, nine)]
#     if i == n:
#         return 1 if (zero and nine) else 0
#     ret = 0
#     for j in range(10):
#         if j == 0:
#             ret += rec(i + 1, True, nine)
#         elif j == 9:
#             ret += rec(i + 1, zero, True)
#         else:
#             ret += rec(i + 1, zero, nine)
#         ret %= mod
#     dp[(i, zero, nine)] = ret
#     return ret

# print(rec(0, False, False))

dp = [[[0 for _ in range(2)] for _ in range(2)] for _ in range(10**6)]
dp[0][0][0] = 1  # どういう意味なのかは不明
for i in range(n):
    for j in range(2):
        for k in range(2):
            for m in range(10):
                if m == 0:
                    dp[i + 1][1][k] += dp[i][j][k]
                    dp[i + 1][1][k] %= mod
                elif m == 9:
                    dp[i + 1][j][1] += dp[i][j][k]
                    dp[i + 1][j][1] %= mod
                else:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j][k] %= mod
print(dp[n][1][1])
# 869121

# 2511445

Submission status: Runtime Error

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

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

dp = {}


def rec(i, zero, nine):
    if (i, zero, nine) in dp:
        return dp[(i, zero, nine)]
    if i == n:
        return 1 if (zero and nine) else 0
    ret = 0
    for j in range(10):
        if j == 0:
            ret += rec(i + 1, True, nine)
        elif j == 9:
            ret += rec(i + 1, zero, True)
        else:
            ret += rec(i + 1, zero, nine)
        ret %= mod
    ret %= mod
    dp[(i, zero, nine)] = ret
    return ret


print(rec(0, False, False))
# 869121

# 2511445

Submission status: Runtime Error

Solution code:
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

ll pow_mod(ll base, ll exp, ll q) {
	base %= q;
	ll ans = 1;
	while (exp) {
		if (exp & 1) ans = (ans * base) % q;	
		base = (base * base) % q;
		exp /= 2;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	cout << pow_mod(10, n, MOD) - 2*pow_mod(9, n, MOD) + pow_mod(8, n, MOD);
}

Submission status: Runtime Error

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

if __namme__ == "__main__":
  main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
print(mod(pow(2,n)-2,1000000007))

Submission status: Runtime Error

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

setrecursionlimit(10**7)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

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

def main():
	n = int(rl())

	@lru_cache(None)
	def dp(i, has0, has9):
		if i == n: return 1 if (has0 and has9) else 0
		cnt = 0
		for d in range(10):
			cnt += dp(i+1, has0 or d == 0, has9 or d == 9)
			cnt %= MOD 
		return cnt 

	print(dp(0, 0, 0))

	stdout.close()

if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

setrecursionlimit(10**5)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

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

def main():
	n = int(rl())

	@lru_cache(None)
	def dp(i, has0, has9):
		if i == n: return 1 if (has0 and has9) else 0
		cnt = 0
		for d in range(10):
			cnt += dp(i+1, has0 or d == 0, has9 or d == 9)
			cnt %= MOD 
		return cnt 

	print(dp(0, 0, 0))

	stdout.close()

if __name__ == "__main__":
	main()