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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()

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

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

Solution (Python):
N = int(input())

MOD = 10**9 + 7

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

print(ans)

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

Solution (Python):
n = int(input())
ans = 0
mod = 10 ** 9 + 7
a = pow(10, n, mod) - pow(9, n, mod)

b = pow(10, n, mod) - pow(8, n, mod)
ans += 2 * a
ans -= b

print(ans % mod)

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

Solution (Python):
n = int(input())

nai_0 = 9 ** n
nai_9 = 9 ** n
nai_09 = 8 ** n

zenbu = 10 ** n

print((zenbu - nai_0 - nai_9 + nai_09) % (10 ** 9 + 7))

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n = onem()

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)

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

N = int(input())

MOD = 10 ** 9 + 7

ALL = pow(10, N, MOD)
ONE = pow(9, N, MOD)
TWO = pow(8, N, MOD)

ans = ALL - ONE - ONE + TWO
ans %= MOD

print(ans)

Solution (Python):

import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7


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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

MOD = 10 ** 9 + 7


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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
mod = 10 ** 9 + 7
n = int(input())
all_num = pow(10, n, mod)
one_num = pow(9, n, mod)
two_num = pow(8, n, mod)
ans = all_num + two_num - (one_num * 2)
ans = ans % mod
print(ans)

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

Solution (Python):
a = 1
b = 1
c = 1
p = 10**9+7
N = int(input())
i = 0
while i < N:
  a = (a*10)%p
  b = (b*9)%p
  c = (c*8)%p
  i += 1
print((a-2*b+c)%p)

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

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

Solution (Python):
N = int(input())

mod = 10 ** 9 + 7

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

Solution (Python):
n = int(input())
mod = 1000000007
def pow(a,n):
    if n == 0:
        return 1
    if n % 2 == 0:
        tmp = pow(a, n//2)
        return (tmp * tmp) % mod
    else:
        tmp = pow(a, n//2)
        return (a * tmp ** 2) % mod

all_pos = pow(10, n)
no_9 = pow(9, n)
no_0 = no_9
no_90 = pow(8,n)

ans = (all_pos - no_9 - no_0 + no_90) % mod
print(ans)

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    N = int(input())
    MOD = 10 ** 9 + 7
    ans = pow(10, N, MOD)
    ans -= pow(9, N, MOD) * 2
    ans += pow(8, N, MOD)
    print(ans % MOD)

if __name__ == '__main__':
    main()

Solution (Python):

mod = 10 ** 9 + 7

N = int(input())

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

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

Solution (Python):
N = int(input())
p = 10**9+7
X1 = pow(10,N,p)
X2 = pow(9,N,p)
X3 = pow(8,N,p)
out = (X1-(X2+X2-X3))%p
print(out)

Solution (Python):
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))

Solution (Python):
N=int(input())
p=10**9+7

def pow_k(x,n,p=10**9+7):
    if n==0:
        return 1
    K=1
    while n>1:
        if n%2!=0:
            K=(K*x)%p
        x=(x*x)%p
        n//=2
    return (K*x)%p


print((pow_k(10,N)-2*pow_k(9,N)+pow_k(8,N))%p)

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

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

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

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
class Combination:
    """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う"""
    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [0] * (n + 1)
        self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD)
        for i in reversed(range(n)):
            self.inv_fact[i] = self.inv_fact[i + 1] * (i + 1) % MOD
        self.MOD = MOD

    def inverse(self, k):
        """kの逆元を求める O(1)"""
        return (self.inv_fact[k] * self.fact[k - 1]) % self.MOD

    def factorial(self, k):
        """k!を求める O(1)"""
        return self.fact[k]

    def inverse_factorial(self, k):
        """k!の逆元を求める O(1)"""
        return self.inv_fact[k]

    def permutation(self, k, r):
        """kPrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r]) % self.MOD

    def combination(self, k, r):
        """kCrを求める O(1)"""
        if k < r:
            return 0
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD

    def combination2(self, k, r):
        """kCrを求める O(r)
        kが大きいが、r <= nを満たしているときに使用
        """
        if k < r:
            return 0
        res = 1
        for l in range(r):
            res *= (k - l)
            res %= self.MOD
        return (res * self.inv_fact[r]) % self.MOD

n = int(input())
MOD = 10 ** 9 + 7
comb = Combination(10 ** 7, MOD)

all_ = pow(10, n, MOD)
not09 = pow(8, n, MOD)

only0 = 0
for i in range(1, n + 1):
    only0 += comb.combination(n, i) * pow(8, n - i, MOD)
    only0 %= MOD
print((all_ - not09 - 2 * only0) % MOD)

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

Solution (Python):
p = 10 ** 9 + 7
N = int(input())

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

Solution (Python):
def pow_mod(x, y, mod=10**9 + 7):
    if y == 0:
        return 1
    res = 1
    for i in range(y.bit_length()):
        if y & (1 << i):
            res *= x
            res %= mod
        x *= x
        x %= mod
    return res


n = int(input())

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
if N == 1:
  print(0)
  exit(0)
mod = 10 ** 9 + 7
res = pow(10, N, mod) - pow(9, N, mod) * 2 + pow(8, N, mod)
print(res % mod)

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

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

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

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


if __name__ == "__main__":
    main()

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

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    MOD=10**9+7

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

    print(ans)




if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    mod = 10**9+7
    tmp_all = 1
    tmp_not09 = 1
    tmp_not0 = 1
    tmp_not9 = 1
    for i in range(n):
        tmp_all *= 10
        tmp_not09 *= 8
        tmp_not0 *= 9
        tmp_not9 *= 9

        tmp_all %= mod
        tmp_not09 %= mod
        tmp_not0 %= mod
        tmp_not9 %= mod

    print((tmp_all + tmp_not09 - tmp_not0 - tmp_not9)%mod)

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

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

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

print(ans)

Solution (Python):
n=input()
c=0
f1=1;f2=1;f3=1
m=10**9+7
for i in range(n):
  f1*=10;f2*=9;f3*=8
  f1%=m;f2%=m;f3%=m
print (f1-2*f2+f3)%m

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

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

Solution (Python):
import sys



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


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

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


if __name__ == "__main__":
    main()

Solution (Python):
(N, ) = [int(n) for n in input().split()]

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

Solution (Python):
mod=10**9+7
n=int(input())
if n==1:print(0);exit()
ans=pow(10,n,mod)
anss=pow(9,n,mod)
ansss=pow(8,n,mod)
print((ans-anss*2+ansss)%mod)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7

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

        
        
        
        
    
if __name__=="__main__":
    main()

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

Solution (Python):
MODULO = 10**9 + 7

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

Solution (Python):
def main():

    N = int(input())
    mod = pow(10, 9) + 7

    if N == 1: return 0
    if N == 2: return 2

    v = 1
    for _ in range(N):
        v *= 8
        v %= mod
    u = 1
    for _ in range(N):
        u *= 9
        u %= mod
    w = 1
    for _ in range(N):
        w *= 10
        w %= mod

    a = w - (u-v) - (u-v) - v
    a %= mod
    return a




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

Solution (Python):


MODULUS = 10**9+7

N = int(input())

ret = pow(10, N, MODULUS)
ret -= 2*pow(9, N, MODULUS)
ret += pow(8, N, MODULUS)

print((ret%MODULUS + MODULUS) % MODULUS)

Solution (Python):
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
Mod=10**9+7
n=int(input())
print((power_func(10,n,Mod)-2*power_func(9,n,Mod)+power_func(8,n,Mod))%Mod)

Solution (Python):
N = int(input())

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

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

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

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

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

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

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

Solution (Python):
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)

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


main()

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

Solution (Python):
n = int(input())
mod = 10**9+7
dp = [[0]*4 for i in range(n+1)]
dp[0][0] = 1
for i in range(n):
    dp[i+1][3] = (dp[i][3]*10 + dp[i][1] + dp[i][2]) % mod
    dp[i+1][2] = (dp[i][2]*9 + dp[i][0]) % mod
    dp[i+1][1] = (dp[i][1]*9 + dp[i][0]) % mod
    dp[i+1][0] = (dp[i][0]*8) % mod

print(dp[n][3])

Solution (Python):
n = int(input())
mod = 10**9+7
def power(a,n):
  ans = 1
  while n:
    if n%2:
      ans = (ans*a)%mod
    a = (a*a)%mod
    n >>= 1
  return ans%mod  
s = power(10,n)
s -= 2*power(9,n)
s += power(8,n)
print(s%mod)

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7


n = int(readline())

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

print(ans)

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

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

print(ans % MOD)

Solution (Python):
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


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


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import itertools

import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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

Solution (Python):

import sys
input = sys.stdin.readline
MOD = 10**9 + 7

n = int(input())

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

print(ret % MOD)

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

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

Solution (Python):
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

MOD = 1_000_000_007

def pow(a, b):
    ret = 1
    while b > 0:
        if (b & 1) == 1:
            ret = ret * a % MOD
        a = a * a % MOD
        b >>= 1
    return ret

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



if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):


import os,sys
from io import BytesIO, IOBase

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


BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

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

Solution (Python):
N=int(input())
C=10**9+7

al=pow(10,N,C)
nze=pow(9,N,C)
nzn=pow(8,N,C)
print((al-nze*2+nzn)%C)

Solution (Python):
N = int(input())

base = 10 ** 9 + 7
A = pow(10, N, base)
B = pow(9, N, base)
C = pow(8, N, base)

print( (A - 2*B + C) % base )

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

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

print(ans)

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

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

print(ans % mod)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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

if __name__ == '__main__':
    main()

Solution (Python):


import sys
readline = sys.stdin.readline
read = sys.stdin.read

n, = map(int,read().split())

MOD = 10**9+7

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

Solution (Python):
N = int(input())

mod = 10**9+7

a9 = 1
a8 = 1
a10 = 1
for _ in range(N):
    a9 = a9 * 9 % mod
    a8 = a8 * 8 % mod
    a10 = a10 * 10 % mod

ans = (a10 - 2*a9 + a8) % mod
print(ans)

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


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

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

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

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

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    ans = pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)
    print(ans%mod)
    return


if __name__ == "__main__":
    solve()

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

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

print((ans + MOD) % MOD)

Solution (Python):
def power(x, n, mod):
    ans = 1
    while n > 0:
        if n % 2 == 1:
            ans = ans * x % mod
        n //= 2
        x = x * x % mod
    return ans

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

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

ans = 1
ans9 = 1
ans8 = 1

for i in range(N):
  ans = ans * 10 % MOD
  ans9 = ans9 * 9 % MOD
  ans8 = ans8 * 8 % MOD

print((ans - ans9 * 2 + ans8) % MOD)

Solution (Python):
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
"""

Solution (Python):
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)

Solution (Python):
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()

Solution (Python):
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()

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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)

Solution (Python):
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())

Solution (Python):
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)