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:
n=int(input())
mod=10**9+7

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
  print(0)
  quit()
mod = 10**9+7
s = 1
n0 = 1
n09 = 1
for i in range(n):
  s*=10
  n0*=9
  n09*=8
  s%=mod
  n0%=mod
  n09%=mod

n0*=2
n0%=mod

ans=s-n0
ans%=mod

ans+=n09
ans%=mod

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
all_pattern = 10**N

not_using_nine_and_zero_pattern = 8**N
using_zero_pattern = all_pattern - 9**N
using_nine_pattern = all_pattern - 9**N

ans = -(all_pattern - not_using_nine_and_zero_pattern -
        using_nine_pattern - using_zero_pattern)

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

Submission status: Accepted

Solution code:
def main():
    MOD = 10 ** 9 + 7

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys


def _i(): return int(sys.stdin.readline().strip())


class Bigint:
    def __init__(self, n, mod=10**9+7):
        self.n = n % mod
        self.mod = mod
        return

    def __str__(self):
        return str(self.n)

    def __add__(self, other):
        ot = type(other)
        if ot == Bigint:
            return Bigint(self.n+other.n, self.mod)
        elif ot == int:
            return Bigint(self.n+other, self.mod)
        else:
            raise ValueError("Invalid type")

    def __iadd__(self, other):
        return self.__add__(other)

    def __sub__(self, other):
        ot = type(other)
        if ot == Bigint:
            o = other.n
        elif ot == int:
            o = other
        else:
            raise ValueError("Invalid type")
        #
        return Bigint(self.n - o, self.mod)

    def __isub__(self, other):
        return self.__sub__(other)

    def __mul__(self, other):
        ot = type(other)
        if ot == Bigint:
            return Bigint(self.n*other.n, self.mod)
        elif ot == int:
            return Bigint(self.n*other, self.mod)
        else:
            raise ValueError("Invalid type")

    def __imul__(self, other):
        return self.__mul__(other)

    def __pow__(self, other):
        assert type(other) == int, "power should be integer"
        #
        if other < 0:
            return self ** (other % (self.mod-1))
        ret = Bigint(1, self.mod)
        now = Bigint(self.n, self.mod)
        while other > 0:
            if other % 2 == 0:
                pass
            else:
                ret *= now
            other //= 2
            now *= now
        return ret

    def __truediv__(self, other):
        ot = type(other)
        if ot == Bigint:
            o = other
        elif ot == int:
            o = Bigint(other)
        else:
            raise ValueError("Invalid type")

        self *= (o ** (o.mod-2))
        return self

    def __itruediv__(self, other):
        return self.__truediv__(other)


def main():
    n = _i()
    a = Bigint(10) ** n
    b = Bigint(8) ** n
    c = Bigint(9) ** n - b
    return a - b - Bigint(2) * c


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
N = int(input())

mod = 10**9 + 7

total = pow(10, N, mod)
not_0 = pow(9, N, mod)
not_9 = not_0
not_9_and_0 = pow(8, N, mod)

ans = ( total - (not_0 + not_9 - not_9_and_0) ) % mod

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-13 20:49:27 +0900
# LastModified: 2020-09-13 21:20:34 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    N = int(input())
    no_0 = 9**N
    no_9 = 9**N
    no_09 = 8**N
    total = 10**N
    print((total-no_0-no_9+no_09)%1000000007)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD =  pow(10,9)+7
def MODINV(n:int, MOD=MOD):
    return pow(n, MOD-2, MOD)

def main():
    N = int(input())
    if N < 2:
        print(0)
        return
    not0 = pow(9, N, MOD)
    not9 = pow(9, N, MOD)
    not0and9 = pow(8, N, MOD)
    ans = pow(10, N, MOD) - not0 - not0 + not0and9
    ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
mod = 10**9 + 7

N = int(input())

total10 = 1
total9 = 1
total8 = 1

for i in range(N):
    total10 = (10*total10)%mod
    total9 = (9*total9)%mod
    total8 = (8*total8)%mod

if N ==2:
    print(2)
else:
    print((total10-2*total9+total8)%mod)

Submission status: Accepted

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

if N == 1:
  print(0)
else:
  a = 1
  b = 1
  c = 1
  for _ in range(N):
    a *= 10
    a %= mod
    b *= 9
    b %= mod
    c *= 8
    c %= mod
  
  ans = a % mod - (2 * b) % mod + c % mod
  print(ans % mod)

Submission status: Accepted

Solution code:
num = int(input())

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

res = (a-2*b+c)%1000000007
print(res)

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:
import sys
input = sys.stdin.readline

N = int(input())

mod = 1e9+7

ten = 1
nine = 1
eight = 1

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

ans = ten - 2 * nine + eight
ans = int(ans)
ans %= mod
if ans < 0:
    ans += mod

print(int(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:
n = int(input())

ALL = (10 ** n) % (10**9 +7)
wo_0 = (9 ** n) % (10**9 +7)
wo_9 = (9 ** n) % (10**9 +7)
wo_0_9 = (8 ** n) % (10**9 +7)

ans = (ALL - (wo_0 + wo_9 - wo_0_9)) % (10**9 +7)
print(ans)

Submission status: Accepted

Solution code:
def main():
	N = int(input())
	p = 1000000007
	ten = [10]
	nine = [9]
	eight = [8]
	for i in range(23):
		ten.append((ten[-1] ** 2) % p)
		nine.append((nine[-1] ** 2) % p)
		eight.append((eight[-1] ** 2) % p)

	t = 1
	n = 1
	e = 1

	b_N = format(N, 'b')
	for i in range(len(b_N)):
		if b_N[- 1 - i] == "1":
			t = (t * ten[i]) % p
			n = (n * nine[i]) % p
			e = (e * eight[i]) % p
	print((t - 2 * n + e) % p)

main()

Submission status: Accepted

Solution code:
#coding:utf-8

N = int(input())

ron = 10 ** 9 + 7

a = (10 ** N) % ron

b = (9 ** N) % ron

c = (9 ** N) % ron 

bandc = (8 ** N) % ron

ans = (a - b - c + bandc) % ron

print("{}".format(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 10**9 + 7
n = int(input())
def exp(x, k):
    exp = 1
    for _ in range(k):
        exp *= x
        exp %= mod
    return exp % mod
print((exp(10, n) - 2 * exp(9, n) + exp(8, n)) % mod)

Submission status: Accepted

Solution code:
import sys

MOD = 10**9 + 7


def main():
    N = int(sys.stdin.readline().rstrip())

    all_ = pow(10, N, MOD)
    ote = pow(8, N, MOD)
    otn = pow(9, N, MOD)
    zte = pow(9, N, MOD)

    ans = all_ - otn - zte + ote

    print(ans % MOD)


main()

Submission status: Accepted

Solution code:
n=int(input())
mod=pow(10,9)+7
ans=pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)
ans=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())
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:
n = int(input())

mod = 10**9+7

all = 10**n 

yobun = 9**n + 9**n- 8**n

ans = all-yobun

print(ans % mod)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
import math
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))

def modpow(base, p, modulo):
    answer = 1
    for _ in range(p):
        answer = (answer*base)%modulo
    return answer

def solve() -> Any:
    N = read_int()
    modulo = 10**9+7
    atleast = pow(10, N, modulo)-pow(9, N, modulo)
    answer = pow(8, N, modulo)+2*atleast-pow(10, N, modulo)
    return answer%modulo


if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline().strip())
mod = 10**9 + 7

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

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

a = 10 ** n
x = 8 ** n
y = 9 ** n

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

s = 1
z = 1
n = 1
zn = 1
e = 10 ** 9 + 7

for i in range(N):
    s = s * 10 % e
    z = z * 9 % e
    n = n * 9 % e
    zn = zn * 8 % e

result = s - z - n + zn

while result < 0:
    result += e

print(result)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10**9+7

x = 1
y = 1
z = 1

for i in range(N):
    x *= 10
    x %= mod
    y *= 9
    y %= mod
    z *= 8
    z %= mod

print((x-y-y+z)%mod)

Submission status: Accepted

Solution code:
#import 
#=input()
n=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n = int(input())
a = pow(9, n, MOD)
b = pow(8, n, MOD)
c = pow(10, n, MOD)

print((c - 2 * a + b)%MOD)

Submission status: Accepted

Solution code:
N = int(input())

r = 10**9 + 7


all = (10 ** N) % r
s1 = (9 ** N) % r
sn = (8 ** N) % r

ans = all - s1 - s1 + sn
ans %= r
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans%mod)

Submission status: Accepted

Solution code:
n = int(input())
mod = 10**9 + 7
if n == 1:
    print(0)
    exit()
    
def fact(a, n): #aのn乗
    ans = 1
    while n:
        if n % 2 == 1:
            ans = ans*a % mod
        a = a*a % mod
        n = n // 2
    return ans % mod

#10**n - (9**n * 2 - 8**n) # 9がないまたは0がない
print( (fact(10, n)%mod - (fact(9, n)%mod * 2 - fact(8, n)%mod) ) % mod)

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:
# coding: utf-8
#a, b, c, d = map(int,input().split())
n=int(input())
ans=1
MOD=10**9+7
a=1
b=1
c=1
for i in range(n):
    a*=10
    a%=MOD
    c*=8
    c%=MOD
for i in range(n):
    b*=9
    b%=MOD
print((a-b*2+c)%MOD)

Submission status: Accepted

Solution code:
n = int(input())

all_combi = pow(10,n,10**9+7)

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

if ans < 0:
    ans += 10**9+7
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

p = 10 ** 9 + 7

dx = 1
d0 = 0
d9 = 0
da = 0
for i in range(N):
    nx = dx * 8
    n0 = d0 * 9 + dx
    n9 = d9 * 9 + dx
    na = da * 10 + d0 + d9

    dx = nx % p
    d0 = n0 % p
    d9 = n9 % p
    da = na % p

print(da)

Submission status: Accepted

Solution code:
N=int(input())
mod=10**9+7
if N==1:
  print(0)
  exit()
dp=[[0,0,0]for i in range(N-1)]
dp[0]=[64,34,2]
for i in range(N-2):
  dp[i+1][2]=dp[i][1]+dp[i][2]*10
  dp[i+1][1]=dp[i][0]*2+dp[i][1]*9
  dp[i+1][0]=dp[i][0]*8
  dp[i+1][2]%=mod
  dp[i+1][1]%=mod
  dp[i+1][0]%=mod
print(dp[-1][-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod=1000000007
def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
    denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
    return numer * denom % mod


def solve():
    pass

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans%mod)

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:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
import bisect

import sys
input = sys.stdin.readline

modulo = (10**9)+7

def solve(n):
    pow9 = 1
    pow8 = 1
    pow7 = 1
    for _ in range(n):
        pow9 = pow9*10%modulo
        pow8 = pow8*9%modulo
        pow7 = pow7*8%modulo
    print((pow9-2*pow8+pow7)%modulo)
            

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C
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
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()

val1 = pow(10,N,mod)
val2 = pow(9,N,mod)
val3 = pow(8,N,mod)

print((val1-2*val2+val3)%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

    all = 10**n % (10**9+7)

    no_zero = 9**n % (10**9+7)
    no_nine = no_zero

    no_nine_and_zero = 8**n % (10**9+7)

    print((all-no_nine-no_zero+no_nine_and_zero) % (10**9+7))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

or_zeronine = 9 ** N
and_zeronine  = 8 ** N
all_ = 10 ** N

ans = all_ - (or_zeronine*2-and_zeronine)

print(ans % mod)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
import heapq

# import numpy as np

# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
flush = lambda: sys.stdout.flush()


# ===CODE===
def main():
    n = ni()

    dp = [[0 for _ in range(4)] for __ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        dp[i + 1][0] += dp[i][0] * 8
        dp[i + 1][1] += dp[i][0] + dp[i][1] * 9
        dp[i + 1][2] += dp[i][0] + dp[i][2] * 9
        dp[i + 1][3] += dp[i][1] + dp[i][2] + dp[i][3] * 10

        for j in range(4):
            dp[i + 1][j] %= MOD
    print(dp[n][3] % MOD)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
#import numpy as np
import re
import math
from collections import defaultdict,deque,Counter
from fractions import Fraction
import bisect
import itertools
from itertools import accumulate
from copy import deepcopy

import heapq
import random
import time
import os
import sys
from functools import lru_cache,reduce
readline=sys.stdin.readline
sys.setrecursionlimit(100000)
alp="abcdefghijklmnopqrstuvwxyz"
numbers="0123456789"
mod=int(10**9+7)
inf=int(10**19)
class Set():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(bool)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        if not self.find(x):
            heapq.heappush(self.heap,x)
            self.dic[x]=True
            self.size+=1

    def remove(self,x):
        if self.find(x):
            self.dic[x]=False
            self.size-=1

    def find(self,x):
        return self.dic[x]
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==False:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class multiset():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(int)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        heapq.heappush(self.heap,x)
        self.dic[x]+=1
        self.size+=1

    def remove(self,x):
        if self.dic[x]>0:
            self.dic[x]-=1
            self.size-=1
    
    def count(self,x):
        return self.dic[x]

    def find(self,x):
        return self.dic[x]>0
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==0:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class Edge():
    def __init__(self,x,y,val=1):
        self.x=x
        self.y=y
        self.val=val
class Point():
    def __init__(self,y,x):
        self.x=x
        self.y=y
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def yn(b):print("yes" if b else "no")
def Yn(b):print("Yes" if b else "No")
def YN(b):print("YES" if b else "NO")
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    return now==a
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n):
    if n==0:return []
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    ret=[]
    for a in range(n+1):
        if(A[a]):ret.append(a)
    return ret
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(b,t,f):return t if b else f
def factorize(n):
    b = 2
    ret=defaultdict(int)
    while b * b <= n:
        while n % b == 0:
            n //= b
            ret[b]+=1
        b+=1
    if n > 1:ret[n]+=1
    return ret
def inputintlist(row=1): 
    if row==1:
        ret=list(map(int,input().split()))
    else:
        ret=[None]*row
        for a in range(row):
            ret[a]=int(input())
    return ret
def inputfloatlist(row=1): 
    if row==1:
        ret=list(map(float,input().split()))
    else:
        ret=[None]*row
        for a in range(row):
            ret[a]=float(input())
    return ret
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def yuukoutomukou(edges):
    ret=deepcopy(edges)
    for edge in edges:
        if not edge.x==edge.y:
            ret.append(Edge(edge.y,edge.x,edge.val))
    return ret
def dijkstra(edges,V,start):
    from queue import PriorityQueue
    mincost=[inf]*V
    G=[[] for a in range(V)]
    for edge in edges:
        G[edge.x].append([edge.val,edge.y])
    Q=PriorityQueue()
    Q.put([0,start])#[cost,x]
    while not Q.empty():
        nowcost,nowx=Q.get()
        if mincost[nowx]==inf:
            mincost[nowx]=nowcost
            for cost,y in G[nowx]:
                newcost=nowcost+cost
                Q.put([newcost,y])
    return mincost
def warshallfloyd(edges,V):
    mincost=[[inf for b in range(V)] for a in range(V)]
    for a in range(V):mincost[a][a]=0
    for edge in edges:
        mincost[edge.x][edge.y]=min(mincost[edge.x][edge.y],edge.val)#x→yが複数ある場合のためにmin()する
    for k in range(V):
        for s in range(V):
            for t in range(V):
                if mincost[s][k]==inf or mincost[k][t]==inf:continue
                mincost[s][t]=min(mincost[s][t],mincost[s][k]+mincost[k][t])
    return mincost
def bellemanford(edges,V,start):
    mincost=[inf]*V
    mincost[start]=0
    for _ in range(V):
        for edge in edges:
            if mincost[edge.x]==inf:continue
            mincost[edge.y]=min(mincost[edge.y],mincost[edge.x]+edge.val)
    return mincost
def getmd(x1,y1,x2,y2):return abs(x1-x2)+abs(y1-y2)
def geted(x1,y1,x2,y2):return math.sqrt((x1-x2)**2+(y1-y2)**2)
class fordfulkerson():
    def __init__(self,edges,V,s,t):
        self.V=V
        self.used=[False]*V
        self.G=[[] for a in range(V)]
        self.s=s
        self.t=t
        for edge in edges:
            self.G[edge.x].append({"x":edge.x,"y":edge.y,"cap":edge.val,"rev":len(self.G[edge.y])})
            self.G[edge.y].append({"x":edge.y,"y":edge.x,"cap":0,"rev":len(self.G[edge.x])-1})
    def dfs(self,v,t,f=inf):
        if v==t:return f
        self.used[v]=True
        for a in range(len(self.G[v])):
            x=self.G[v][a]["x"]
            y=self.G[v][a]["y"]
            cap=self.G[v][a]["cap"]
            rev=self.G[y][self.G[x][a]["rev"]]
            if self.used[y] or cap==0:continue
            f2=self.dfs(y,t,min(f,cap))
            if f2>0:
                self.G[v][a]["cap"]-=f2
                rev["cap"]+=f2
                return f2
        return 0
    def maxflow(self):
        flow=0
        while True:
            self.used=[False]*V
            zouka=self.dfs(self.s,self.t)
            if zouka==0:break
            flow+=zouka
        return flow
def zipsort(*args):
    ziplist=sorted(zip(*args))
    for a in range(len(args)):
        for b in range(len(ziplist)):
            args[a][b]=ziplist[b][a]
def zipreverse(*args):
    ziplist=list(zip(*args))
    rev=[]
    for a in range(len(ziplist)-1,-1,-1):
        rev.append(ziplist[a])
    for a in range(len(args)):
        for b in range(len(rev)):
            args[a][b]=rev[b][a]

def to10(A):
    ret=0
    for a in range(len(A)-1,-1,-1):
        ret+=X[a]*2**(N-1-a)
    return ret
######################################################################################################
N=int(input())
if N<2:
    print(0)
    exit()
al=pow(10,N,mod)
s0=pow(9,N,mod)
s9=pow(9,N,mod)
s09=pow(8,N,mod)
ans=(al-((s0+s9-s09+mod)%mod)+mod)%mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
import copy
import math
from itertools import accumulate
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def floor(a, b): return -(-a // b)


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


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


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


def C(line): return [sys.stdin.readline() for _ in range(line)]


MOD = 10**9 + 7
N = z()
if (N >= 2):

    # 0使わないのは
    zero_nasi = pow(9, N, MOD)
    # 1を使わないのは
    one_nasi = pow(9, N, MOD)
    # 0も1も使わないのは
    zero_one_nasi = pow(8, N, MOD)
    # 全部は
    all_ = pow(10, N, MOD)

    ans = (all_ - zero_nasi - one_nasi + zero_one_nasi) % MOD

else:
    ans = 0


print(ans)

Submission status: Accepted

Solution code:
n = int(input())

mod = 10**9 + 7

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

print(ans % mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N):
    mod = 10 ** 9 + 7
    a = 10 ** N - (9 ** N + 9 ** N - 8 ** N)
    print(a % mod)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # Ai = [int(i) for i in input().split()]
    # Bi = [int(i) for i in input().split()]
    # ABi = [[int(i) for i in input().split()] for _ in range(N)]
    solve(N)

    # # test
    # from random import randint
    # from func import random_str
    # solve()

Submission status: Accepted

Solution code:
p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
N = int(input())
ans = (pow(10,N)-2*pow(9,N)+pow(8,N))%p
print(ans)

Submission status: Accepted

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