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:
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
#threading.stack_size(10**8)
mod = 10 ** 9 + 7
mod1 = 998244353

# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
#sys.setrecursionlimit(300000)

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


# -------------------game starts now----------------------------------------------------import math
class TreeNode:
    def __init__(self, k, v):
        self.key = k
        self.value = v
        self.left = None
        self.right = None
        self.parent = None
        self.height = 1
        self.num_left = 1
        self.num_total = 1


class AvlTree:

    def __init__(self):
        self._tree = None

    def add(self, k, v):
        if not self._tree:
            self._tree = TreeNode(k, v)
            return
        node = self._add(k, v)
        if node:
            self._rebalance(node)

    def _add(self, k, v):
        node = self._tree
        while node:
            if k < node.key:
                if node.left:
                    node = node.left
                else:
                    node.left = TreeNode(k, v)
                    node.left.parent = node
                    return node.left
            elif node.key < k:
                if node.right:
                    node = node.right
                else:
                    node.right = TreeNode(k, v)
                    node.right.parent = node
                    return node.right
            else:
                node.value = v
                return

    @staticmethod
    def get_height(x):
        return x.height if x else 0

    @staticmethod
    def get_num_total(x):
        return x.num_total if x else 0

    def _rebalance(self, node):

        n = node
        while n:
            lh = self.get_height(n.left)
            rh = self.get_height(n.right)
            n.height = max(lh, rh) + 1
            balance_factor = lh - rh
            n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
            n.num_left = 1 + self.get_num_total(n.left)

            if balance_factor > 1:
                if self.get_height(n.left.left) < self.get_height(n.left.right):
                    self._rotate_left(n.left)
                self._rotate_right(n)
            elif balance_factor < -1:
                if self.get_height(n.right.right) < self.get_height(n.right.left):
                    self._rotate_right(n.right)
                self._rotate_left(n)
            else:
                n = n.parent

    def _remove_one(self, node):
        """
        Side effect!!! Changes node. Node should have exactly one child
        """
        replacement = node.left or node.right
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = replacement
            else:
                node.parent.right = replacement
            replacement.parent = node.parent
            node.parent = None
        else:
            self._tree = replacement
            replacement.parent = None
        node.left = None
        node.right = None
        node.parent = None
        self._rebalance(replacement)

    def _remove_leaf(self, node):
        if node.parent:
            if AvlTree._is_left(node):
                node.parent.left = None
            else:
                node.parent.right = None
            self._rebalance(node.parent)
        else:
            self._tree = None
        node.parent = None
        node.left = None
        node.right = None

    def remove(self, k):
        node = self._get_node(k)
        if not node:
            return
        if AvlTree._is_leaf(node):
            self._remove_leaf(node)
            return
        if node.left and node.right:
            nxt = AvlTree._get_next(node)
            node.key = nxt.key
            node.value = nxt.value
            if self._is_leaf(nxt):
                self._remove_leaf(nxt)
            else:
                self._remove_one(nxt)
            self._rebalance(node)
        else:
            self._remove_one(node)

    def get(self, k):
        node = self._get_node(k)
        return node.value if node else -1

    def _get_node(self, k):
        if not self._tree:
            return None
        node = self._tree
        while node:
            if k < node.key:
                node = node.left
            elif node.key < k:
                node = node.right
            else:
                return node
        return None

    def get_at(self, pos):
        x = pos + 1
        node = self._tree
        while node:
            if x < node.num_left:
                node = node.left
            elif node.num_left < x:
                x -= node.num_left
                node = node.right
            else:
                return (node.key, node.value)
        raise IndexError("Out of ranges")

    @staticmethod
    def _is_left(node):
        return node.parent.left and node.parent.left == node

    @staticmethod
    def _is_leaf(node):
        return node.left is None and node.right is None

    def _rotate_right(self, node):
        if not node.parent:
            self._tree = node.left
            node.left.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.left
            node.left.parent = node.parent
        else:
            node.parent.right = node.left
            node.left.parent = node.parent
        bk = node.left.right
        node.left.right = node
        node.parent = node.left
        node.left = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    def _rotate_left(self, node):
        if not node.parent:
            self._tree = node.right
            node.right.parent = None
        elif AvlTree._is_left(node):
            node.parent.left = node.right
            node.right.parent = node.parent
        else:
            node.parent.right = node.right
            node.right.parent = node.parent
        bk = node.right.left
        node.right.left = node
        node.parent = node.right
        node.right = bk
        if bk:
            bk.parent = node
        node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
        node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
        node.num_left = 1 + self.get_num_total(node.left)

    @staticmethod
    def _get_next(node):
        if not node.right:
            return node.parent
        n = node.right
        while n.left:
            n = n.left
        return n


# -----------------------------------------------binary seacrh tree---------------------------------------
class SegmentTree1:
    def __init__(self, data, default=0, func=lambda a, b: max(a , b)):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)


# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a, b:a + b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)


# -------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]


class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD


# --------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m


# --------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z


# --------------------------------------------------product----------------------------------------
def product(l):
    por = 1
    for i in range(len(l)):
        por *= l[i]
    return por


# --------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left) / 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid] < key):
            count = mid + 1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count


# --------------------------------------------------binary----------------------------------------
def countdig(n):
    c = 0
    while (n > 0):
        n //= 10
        c += 1
    return c
def binary(x, length):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y

def countGreater(arr, n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)
        if (arr[m] >= k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)


# --------------------------------------------------binary------------------------------------
n=int(input())
ans=pow(10,n,mod)
ans-=(2*pow(9,n,mod))%mod
ans%=mod
ans+=pow(8,n,mod)
ans%=mod
print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
M = 10**9+7
v1 = pow(9, n, M)
v2 = pow(8, n, M)
ans = pow(10, n, M) - v1*2 + v2
print(ans%M)

Submission status: Accepted

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

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

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

    divisors.sort()
    return divisors

inf = 10 ** 18
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
MOD = 10**9 + 7

def main():
    n = int(input())
    if n == 1:
        print(0)
    else:
        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()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
p = 10**9+7
dp = [8,2,0]

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

print(dp[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

n = inn()
print((pow(10,n,R)-2*pow(9,n,R)+pow(8,n,R))%R)

Submission status: Accepted

Solution code:
p=10**9+7

n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

no0 = 9**n
no9 = 9**n
no09 = 8**n

ans = (10**n - (no0 + no9 - no09)) % (10**9+7)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N = int(input())

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

Submission status: Accepted

Solution code:
mod = 10**9+7

n = int(input())

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

answer_10 = 1
answer_9 = 1
answer_8 = 1

for _ in range(N):
  answer_10 = (answer_10*10)%mod
  answer_9 = (answer_9*9)%mod
  answer_8 = (answer_8*8)%mod

answer = (answer_10 - 2*answer_9 + answer_8)%mod

print(answer)

Submission status: Accepted

Solution code:
N = int(input())

M = 10**9+7
print((pow(10, N, M)-pow(9, N, M)*2+pow(8, N, M))%M)

Submission status: Accepted

Solution code:
n = int(input())
MOD = 10 ** 9 + 7
ans = pow(10, n, MOD)
tmp = pow(8, n, MOD)
tmp2 = pow(9, n, MOD)

print((ans + tmp - (tmp2 * 2) % MOD) % MOD)

Submission status: Accepted

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

a = 8
b = 1
c = 1
d = 0

for _ in range(N-1):
    at = a * 8
    bt = b * 9 + a * 1
    ct = c * 9 + a * 1
    dt = b * 1 + c * 1 + d * 10
    a = at % MOD
    b = bt % MOD
    c = ct % MOD
    d = dt % MOD

print(d)

Submission status: Accepted

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

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

print(tmp % mod)

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
m=10**9+7
ans=pow(10,n)-pow(9,n)*2+pow(8,n)
print(ans%m)

Submission status: Accepted

Solution code:
MOD = 10**9 + 7

N = int(input())

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

Submission status: Accepted

Solution code:

n = int(input())
mod = 10**9 + 7
if n==1:
    print(0)
else:
    #0が入ってるいる個数
    a = pow(10,n,mod) - pow(9,n,mod)
    #9が入っている個数
    b = pow(10,n,mod) - pow(9,n,mod)
    #0か9が入っている
    c = pow(10,n,mod) - pow(8,n,mod)

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

Submission status: Accepted

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

ma = 1
zero,nine,bot = 1,1,1
for i in range(n):
    ma = ma * 10 % MOD
    zero = zero * 9 % MOD
    nine = nine * 9 % MOD
    bot = bot * 8 % MOD
    
cur = (zero + nine + MOD - bot) % MOD
ans = ((ma+MOD) - cur) % MOD

print(ans)

Submission status: Accepted

Solution code:
m = 1000000007

N = int(input())

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
mod = 10**9+7
if N<2:
    print(0)
    exit()

full = pow(10, N, mod)
# 0を含まない
zero = pow(9, N, mod)
# 9を含まない
nine = pow(9, N, mod)
# 0, 9を一つも含まない
zero_nine = pow(8, N, mod)

ans = (full-zero-nine+zero_nine)%mod
print(ans)

Submission status: Accepted

Solution code:
def solve(n):
    mod = 10 ** 9 + 7
    return (pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod


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


def test():
    assert solve(2) == 2
    assert solve(1) == 0
    assert solve(869121) == 2511445


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

Submission status: Accepted

Solution code:
mod=10**9+7
N=int(input())
'''
0と9が存在する
逆は
0が存在しない+9が存在しない-0と9が両方存在しない
'''
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

#10 ** N - 2 * (9 ** N) + (8 ** N)
ten = 1
nine = 1
eight = 1
for i in range(N):
  ten *= 10
  ten %= mod
  nine *= 9
  nine %= mod
  eight *= 8
  eight %= mod
  
ans = ten - 2 * nine + eight  
print(ans % mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 1
mians = 1
mians2 = 1
for i in range(N):
    ans *= 10
    ans %= 10 ** 9 + 7
for i in range(N):
    mians *= 9
    mians %= 10 ** 9 + 7
for i in range(N):
    mians2 *= 8
    mians2 %= 10 ** 9 + 7
mians = mians * 2 - mians2
if mians < 0:
    mians += 10 ** 9 + 7
mians %= 10 ** 9 + 7
ans -= mians
if ans < 0:
    ans += 10 ** 9 + 7
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

U = pow(10, N, mod)
one = pow(9, N, mod)
two = pow(8, N, mod)

ans = U - ( 2 * one - two)
ans %= mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def power(a, n, mod):
    bi=str(format(n,"b")) #2進数
    res=1
    for i in range(len(bi)):
        res=(res*res) %mod
        if bi[i]=="1":
            res=(res*a) %mod
    return res

a = power(10, n, mod)-power(8, n, mod)
b = power(10, n, mod)-power(9, n, mod)
ans = b*2-a
print(ans%mod)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
import sys
gcd = math.gcd
n = ni()
mod = 10**9+7
ans = pow(10,n,mod)-pow(9,n,mod)-pow(9,n,mod)+pow(8,n,mod)
ans %=mod
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
mod = int(1e+9)+7

answer = pow(10, N, mod)

notzero = pow(9, N, mod)
notq = pow(9, N, mod)

notzero_notq = pow(8, N, mod)

print((answer - notzero -notq +notzero_notq)%mod)

Submission status: Accepted

Solution code:
n= int(input())

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

Submission status: Accepted

Solution code:
n=int(input())

mod=10**9+7

a1=1
a2=1
a3=1
for i in range(n):
  a1*=10
  a2*=9
  a3*=8
  a1%=mod
  a2%=mod
  a3%=mod

ans=a1-a2-a2+a3
ans%=mod
print(ans)

Submission status: Accepted

Solution code:
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N = II()
    print((pow(10,N,P)-2*pow(9,N,P)+pow(8,N,P))%P)
    
main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N=int(input())
    mod=10**9+7
    all=pow(10,N,mod)
    res=(all-2*pow(9,N,mod)+pow(8,N,mod))%mod
    print(res)
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())

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

MOD=10**9+7

ALL=pow(10,N,MOD)
No0=pow(9,N,MOD)
No9=pow(9,N,MOD)
No09=pow(8,N,MOD)

ans=ALL-No9-No0+No09+MOD
print(ans%MOD)

Submission status: Accepted

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

# 0がない　または　9がない
one = 1
two = 1
al = 1

for i in range(n):
    one *= 9
    one %= mod
    two *= 8
    two %= mod
    al *= 10
    al %= mod

print((al - (2 * one - two))%mod)

Submission status: Accepted

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

n=int(input())

INF=10**9+7

ans=0
ans=pow(10,n,INF)

ans-=pow(8,n,INF)

temp=pow(10,n,INF)-pow(9,n,INF)
ans=temp*2-ans

ans=ans%INF

print(ans)