Problem:


Score : 300 points

Problem Statement

How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions?

0 \leq A_i \leq 9

There exists some i such that A_i=0 holds.

There exists some i such that A_i=9 holds.

The answer can be very large, so output it modulo 10^9 + 7.

Constraints

1 \leq N \leq 10^6

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer modulo 10^9 + 7.

Sample Input 1

2

Sample Output 1

2

Two sequences \{0,9\} and \{9,0\} satisfy all conditions.

Sample Input 2

1

Sample Output 2

0

Sample Input 3

869121

Sample Output 3

2511445



Sample input:
2


Sample output:
2

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  if n==1:
    return 0
  ans=10
  a=9
  b=9
  c=8
  for _ in range(n-1):
    ans*=10
    ans%=mod
    a*=9
    a%=mod
    b*=9
    b%=mod
    c*=8
    c%=mod

  return (ans-(a+b-c))%mod

# main()
print(main())

Submission status: Accepted

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

Submission status: Accepted

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

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


n = int(input())
mod = int(1e9+7)
a = pow(10,n,mod)
b = pow(8,n,mod)
c = (pow(9,n,mod)-b)*2
print((a-b-c)%mod)

Submission status: Accepted

Solution code:
n = int(input())

N=10**9+7

def fac(n,r,N):
    ans=1
    for i in range(r):
        ans=ans*(n-i)%N
    return ans

def combi(n,r,N):
    if n<r or n<0 or r<0:
        ans = 0
        return ans
    if n==r:
        ans = 1
        return ans
    r= min(r, n-r)
    ans = fac(n,r,N)*pow(fac(r,r,N),N-2,N)%N
    return ans


if n==1:
    print(0)
    exit()
else:
    ans1=pow(10,n,N)-pow(9,n,N)*2+pow(8,n,N)
    ans1%=N
    if ans1<0:
        ans1+=N
    print(ans1)

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:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
MOD=10**9+7
#======================================================#
def main():
    n = II()
    sumv10 = 1
    for _ in range(n):
        sumv10 *= 10
        sumv10 %= MOD
    sumv9 = 1
    for _ in range(n):
        sumv9 *= 9
        sumv9 %= MOD
    sumv9 *= 2
    sumv8 = 1
    for _ in range(n):
        sumv8 *= 8
        sumv8 %= MOD
    print((sumv10 - sumv9 + sumv8)%MOD)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9+7
if n == 1:
    print(0)
else:
    ans0, ans1, ans2 = 1, 1, 1
    for i in range(n):
        ans0 *= 10
        ans1 *= 9
        ans2 *= 8
        ans0 %= mod
        ans1 %= mod
        ans2 %= mod
    print((ans0-ans1*2+ans2)%mod)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1


N=int(input())

def COMinit(n,MOD):
    fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,(n+1)):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv

fac,finv,inv=COMinit(N,MOD)

def COM(n, k, MOD=MOD):
    if n<k or n<0 or k<0:
        return 0
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD


ans=0
for k in range(2,N+1):
    ans+=COM(N,k)*(pow(2,k,MOD)-2)*pow(8,N-k,MOD)
    ans%=MOD
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
mod = 10**9 + 7
if n == 1:
    print(0)
else:
    print((10**n % mod + 8**n % mod - 9**n % mod - 9**n % mod) % mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    if N < 2:
        print(0)
    else:
        MOD = 10 ** 9 + 7
        U = pow(10, N, MOD)
        A = (U - pow(8, N, MOD)) % MOD
        B = (U - pow(9, N, MOD)) % MOD
        ans = (B * 2 - A) % MOD
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input(""))
a=1
b=2
c=1
while(n>10):
    n-=10
    a*=10**10
    b*=9**10
    c*=8**10
    a%=(10**9+7)
    b%=(10**9+7)
    c%=(10**9+7)

    
for i in range(n):
    a*=10
    b*=9
    c*=8
    if(i%10==0):
        a%=(10**9+7)
        b%=(10**9+7)
        c%=(10**9+7)

s=a+c-b
s%=(10**9+7)
print(s)

Submission status: Accepted

Solution code:
def power(base, exp, mod):
  if exp <= 0:
    return 1
  if exp <= 1:
    return base % mod
  if exp % 2 == 1:
    return (base * power(base, exp - 1, mod)) % mod

  root = power(base, exp // 2, mod)
  return (root * root) % mod


MOD = int(1e9 + 7)
n = int(input())

if n == 1:
  print(0)
else:
  res = power(10, n, MOD) - 2 * power(9, n, MOD) + power(8, n, MOD)
  while res < 0:
    res += MOD
  res %= MOD

  print(res)

Submission status: Accepted

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

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=1000000007
x=10**n - 2*9**n + 8**n
print(x%A)

Submission status: Accepted

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

c = 1
c0 = 0
c1 = 0
c01 = 0

for _ in range(N):

    c01 = (c0+c1+c01*10)%MOD
    c0 = (c + c0*9)%MOD
    c1 = (c + c1*9)%MOD
    c = (c*8)%MOD

print(c01)

Submission status: Accepted

Solution code:
N = int(input())

y = 10**N - 2*(9**N) + 8**N

y_d = y % ( 10**9 + 7 )

print(y_d)

Submission status: Accepted

Solution code:
n = int(input().rstrip())
if n==1:
    print(0)
else:
    MOD = 1_000_000_007
    a = 1
    b = 1
    c = 1
    for i in range(n):
        a = (a*10)%MOD
        b = (b*9)%MOD
        c = (c*8)%MOD
    print((a-b-b+c+MOD+MOD)%MOD)

Submission status: Accepted

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

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

    res = nine - (2 * eight) + seven
    res %= mod

    print(res)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


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


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

    mod = 10 ** 9 + 7
    na = 10 ** n
    n8 = 8 ** n
    n9 = 9 ** n * 2
    print((na - n9 + n8) % mod)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
mod = 10 ** 9 + 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
a1 = power_func(10,n,mod)
a2 = power_func(9,n,mod)
a3 = power_func(8,n,mod)
print((a1 + a3 - a2 * 2 + mod) % mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
INF = 10**9+7
t = 1
e = 1
n = 1
for i in range(N):
  t = (t*10)%INF
  e = (e*8)%INF
  n = (n*9)%INF
print((t-2*n+e)%INF)

Submission status: Accepted

Solution code:
N = int(input())
sumall = 10 ** N
without0 = 9**N
without9 = 9**N
without0and9 = 8**N
ans = (sumall - (without0 + without9 - without0and9))%(10**9 + 7)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def pf(a,n,p):
    bi = str(format(n,"b"))
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

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

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

print(ans%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())

base = 10 ** 9 + 7
x = 10 ** N % base
A0 = 9 ** N % base
A9 = 9 ** N % base
A09 = 8 ** N % base
ans = (x - (A0 + A9 - A09))
print(ans % base)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
import os

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
MOD = 10 ** 9 + 7

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


print(ans%MOD)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N = INT()

dp = list2d(3, N+1, 0)
dp[0][0] = 1
for i in range(N):
    dp[0][i+1] += dp[0][i] * 8
    dp[1][i+1] += dp[0][i] * 2
    dp[1][i+1] += dp[1][i] * 9
    dp[2][i+1] += dp[1][i]
    dp[2][i+1] += dp[2][i] * 10
    dp[0][i+1] %= MOD
    dp[1][i+1] %= MOD
    dp[2][i+1] %= MOD
ans = dp[2][N]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
if N==1:
    print(0)
elif N==2:
    print(2)
else:
    b,c=1,1
    for _ in range(N):
        b*=9
        c*=8
        if b>=(10**9+7):
            b%=(10**9+7)
        if c>=(10**9+7):
            c%=(10**9+7)
        

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

Submission status: Accepted

Solution code:
N=int(input())
#map(int, input().split())
#list(map(int, input().split()))

ans1 = 1
ans2 = 1
ans3 = 1
b=10**9+7
for i in range(N):
    ans1 *= 10
    ans1 %= b
    ans2 *= 9
    ans2 %= b
    ans3 *= 8
    ans3 %= b

ans = (ans1-2*ans2+ans3)%b

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
mod = int(1e9) + 7

a = 1
b = 1
c = 1

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

ans = (a - (2*c - b % mod)%mod + mod) % 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:
N = int(input())
MOD = 10**9 + 7
def power(x, y, p) : 
    res = 1     # Initialize result 
  
    # Update x if it is more 
    # than or equal to p 
    x = x % p  
      
    if (x == 0) : 
        return 0
  
    while (y > 0) : 
          
        # If y is odd, multiply 
        # x with result 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
  
        # y must be even now 
        y = y >> 1      # y = y/2 
        x = (x * x) % p 
          
    return res 
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:
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 21:12:17 2020

@author: liang
"""

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 1 << 60


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
def slv(N):
    M = Mod(10**9 + 7)
    ans = M.pow(10, N)
    ans = M.sub(ans, M.pow(9, N))
    ans = M.sub(ans, M.pow(9, N))
    ans = M.add(ans, M.pow(8, N))


    return ans


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

tot = 10**n

inc0 = (tot - 9**n)%mod
inc9 = (tot - 9**n)%mod
inc0or9 = (tot - 8**n)%mod

ans = (inc0+inc9-inc0or9)%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:
def ii(): return int(input())


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


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


MOD = 10**9 + 7


class ModInt:

    def __init__(self, x):
        self.x = x.x if isinstance(x, ModInt) else x % MOD

    def __str__(self): return str(self.x)
    __repr__ = __str__
    def __int__(self): return self.x
    __index__ = __int__

    def __add__(self, other): return ModInt(self.x + ModInt(other).x)
    def __sub__(self, other): return ModInt(self.x - ModInt(other).x)
    def __mul__(self, other): return ModInt(self.x * ModInt(other).x)
    def __pow__(self, other): return ModInt(pow(self.x, ModInt(other).x, MOD))
    def __truediv__(self, other): return ModInt(
        self.x * pow(ModInt(other).x, MOD - 2, MOD))

    def __floordiv__(self, other): return ModInt(self.x // ModInt(other).x)
    def __radd__(self, other): return ModInt(other + self.x)
    def __rsub__(self, other): return ModInt(other - self.x)
    def __rpow__(self, other): return ModInt(pow(other, self.x, MOD))
    def __rmul__(self, other): return ModInt(other * self.x)
    def __rtruediv__(self, other): return ModInt(
        other * pow(self.x, MOD - 2, MOD))

    def __rfloordiv__(self, other): return ModInt(other // self.x)

    def __lt__(self, other): return self.x < ModInt(other).x
    def __gt__(self, other): return self.x > ModInt(other).x
    def __le__(self, other): return self.x <= ModInt(other).x
    def __ge__(self, other): return self.x >= ModInt(other).x
    def __eq__(self, other): return self.x == ModInt(other).x
    def __ne__(self, other): return self.x != ModInt(other).x


def cmb(n, r):  # nCr = n!/(n-r)!r!
    retVal = 1
    for i in range(n-r+1, n+1):
        retVal *= i
    for i in range(2, r+1):
        retVal //= i
    return retVal


n = ii()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

class PowMod:
	def __init__(self, N, base=[2]):
		self.mem = {}
		for b in base:
			pows = [1]
			for i in range(1, N+1):
				pows.append(pows[-1]*b % mod)
			self.mem[b] = pows

	def pow(self, b, n):
		return self.mem[b][n]

N = ri()

pm = PowMod(N, base=[8,9,10])
ans = pm.pow(10, N) - pm.pow(9, N)*2 + pm.pow(8, N)
#print(pm.pow(10, N), pm.pow(9, N), pm.pow(8, N))
print(ans % mod)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

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

ans = 1

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

ans_2 = 1

for i in range(n):
    ans_2 *= 9
    ans_2 %= mod
ans_3 = 1

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


print((ans - 2*ans_2 + ans_3) % mod)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from math import trunc
import sys
import copy
from collections import deque
import collections
import itertools
stdin = sys.stdin
import math

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def pow(x, n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x % MOD
        
        x = x**2 % MOD
        n >>= 1
    return res

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
mod = 10 ** 9 + 7
if N == 1:print(0)
else: print((pow(8,N,mod) - 2 * pow(9,N,mod) + pow(10,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)
print(ans%mod)

Submission status: Accepted

Solution code:
#ABC178-c
import sys,math,collections,itertools
input = sys.stdin.readline
m=10**9+7
N=int(input())
#すべての数列の数
nAll=pow(10,N,m)
nwo0 = pow(9,N,m)
nwo9 = nwo0
nwo09 = pow(8,N,m)
ans = nAll-nwo0-nwo9+nwo09
while ans<0:
    ans +=m
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

print(res)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

Submission status: Accepted

Solution code:
MOD = 10**9+7
n = int(input())
all_cnt = pow(10,n,MOD)
no09 = pow(8,n,MOD)
yes09 = all_cnt-no09

no0 = pow(9,n,MOD)
yes0 = all_cnt-no0
yes9 = yes0

ans = yes0+yes9-yes09
print(ans%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())
x=0
A=1
B=1
C=1
mod=10**9+7
while x<n:
    A=(A*10)%mod
    B=(B*9)%mod
    C=(C*8)%mod
    x+=1
B=(B*2)%mod
print((A-B+C)%mod)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


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


if __name__ == "__main__":
    run()

Submission status: Accepted

Solution code:
#Python Template

from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	prime = 10**9 + 7
	if n == 1:
		print(0)
	else:
		total = (10**n)%prime
		no0 = (9**n)%prime
		inter = (8**n)%prime
		ans = (total-(no0*2-inter)+prime)%prime
		print(ans)

	

main()

Submission status: Accepted

Solution code:
def main():
    MOD = 10**9 + 7
    N = int(input())
    n_10 = 1
    n_9 = 1
    n_8 = 1
    for _ in range(N):
        n_10 *= 10
        n_9 *= 9
        n_8 *= 8
        n_10 %= MOD
        n_9 %= MOD
        n_8 %= MOD
    print((2 * (n_10 - n_9) - (n_10 - n_8)) % MOD)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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)
if ans<0:
    ans += MOD
if ans<0:
    ans += MOD
ans %= MOD
print(ans)

Submission status: Accepted

Solution code:
MOD = 10**9+7
#nCrは以下のやつ全てを使ってください
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

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

N = int(input())
if N == 1:
    print(0)
else:
    ALL = pow(10,N,MOD)
    p0 = pow(9,N,MOD)
    in0 = ALL - pow(9,N,MOD)
    in9 = ALL - pow(9,N,MOD)
    p09 = pow(8,N,MOD)
    in09 = ALL - p09
    print((in0+in9-in09)%MOD)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def pow(a):
  ans  = 1
  for i in range(n):
    ans = (ans * a) % p
  return ans
x = (pow(10) - pow(9) * 2 + pow(8)) % p
print(x)

Submission status: Accepted

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

a = 1
b = 1
c = 1

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

Submission status: Accepted

Solution code:
n = int(input())
ans_max = 1
for i in range(n):
    ans_max = ans_max * 10 % 1000000007

ans_mid = 1
for i in range(n):
    ans_mid = ans_mid * 9 % 1000000007
ans_mid = ans_mid * 2 % 1000000007

ans_min = 1
for i in range(n):
    ans_min = ans_min * 8 % 1000000007
ans = (ans_max - (ans_mid - ans_min)) % 1000000007
print(ans)

Submission status: Accepted

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

if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    ans = (mod*3+pow(10,N,mod)-pow(9,N,mod)*2+pow(8,N,mod))%mod
    print(ans)

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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline

    n = int(input().rstrip())

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# map(int, input().split())
N = int(input())

mod = pow(10,9)+7

def pow_mod(x,n,mod):
    ans = 1
    for i in range(n):
        ans = (ans*x)%mod

    return ans

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

print(ans%mod)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

    print(total)

main()

Submission status: Accepted

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

if N <= 1:
    print(0)
else:
    all_A = pow(10, N, MOD) + MOD
    non_0_9_A = pow(8, N, MOD)
    non_0_A = pow(9, N, MOD)
    e_0_A = (all_A - non_0_A) % MOD
    e_0_or_9_A = (all_A - non_0_9_A) % MOD
    print((e_0_A * 2 - e_0_or_9_A) % MOD)

Submission status: Accepted

Solution code:
n=int(input())
mul10=1
mul9=1
mul8=1
mod=1e9+7
for i in range(n):
    mul10*=10
    mul10%=mod
    mul9 *= 9
    mul9 %= mod
    mul8*=8
    mul8%=mod

ans=mul10-2*mul9+mul8
ans%=mod
print(int(ans)//1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())
zero = 9 ** N
nine = 9 ** N
zero_nine = 8 ** N
full = 10 ** N
ans = (full - zero - nine + zero_nine) % (10 ** 9 + 7)

print(ans)

Submission status: Accepted

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

def comb(n,k,p):
    """power_funcを用いて(nCk) mod p を求める"""
    from math import factorial
    if n<0 or k<0 or n<k: return 0
    if n==0 or k==0: return 1
    a=factorial(n) %p
    b=factorial(k) %p
    c=factorial(n-k) %p
    return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
    """a^b mod p を求める"""
    if b==0: return 1
    if b%2==0:
        d=power_func(a,b//2,p)
        return d*d %p
    if b%2==1:
        return (a*power_func(a,b-1,p ))%p

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

Submission status: Accepted

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()