AtCoder Beginner Contest 178 - Ubiquity

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-----
2

-----Sample Output-----
2

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

Source: atcoder | Difficulty: EASY


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


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


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


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


N = int(input())
mod = 10 ** 9 + 7
S = 10 ** N - 2 * 9 ** N + 8 ** N
print(S % mod)


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


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


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


N = int(input())
a = 10 ** N - 9 ** N - 9 ** N + 8 ** N
print(a % (10 ** 9 + 7))


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


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


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


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


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


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)


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


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


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


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


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


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


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


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


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


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


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


n = int(input())
mod = 1000000000.0 + 7

def powmod(x, y):
	res = 1
	for _ in range(y):
		res *= x
		res %= mod
	return res
ans = powmod(10, n) - powmod(9, n) - powmod(9, n) + powmod(8, n)
ans %= mod
ans = int(ans)
print(ans)


N = int(input())
mod = 10 ** 9 + 7
A = 10 ** N % mod - 2 * 9 ** N % mod + 8 ** N % mod
print(A % mod)


import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10 ** 9

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

def __starting_point():
	main()
__starting_point()


n = int(input())
p = 10 ** 9 + 7
k = 10 ** n % p
l = 2 * 9 ** n % p
m = 8 ** n % p
ans = (k - l + m) % p
print(ans)


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


import numpy as np

def __starting_point():
	input_str = input()
	n = int(input_str)
	peterns = 10 ** n
	a0_subset = peterns - 9 ** n
	a9_subset = peterns - 9 ** n
	anti_subset = 8 ** n
	ans = a0_subset + a9_subset + anti_subset - peterns
	ans %= 10 ** 9 + 7
	print(ans)
__starting_point()


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


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


from scipy.special import perm
N = int(input())
mod = 1000000007
ans = 10 ** N - 9 ** N - 9 ** N + 8 ** N
ans %= mod
print(ans)


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


N = int(input())
M = 10 ** 9 + 7
a = 10 ** N % M
b = 2 * 9 ** N % M
c = 8 ** N % M
print((a - b + c) % M)


import sys

def solve():
	N = int(input())
	mod = 7 + 10 ** 9
	total = pow(10, N, mod)
	noZeroOrNine = pow(9, N, mod)
	noZeroAndNine = pow(8, N, mod)
	print((total - 2 * noZeroOrNine + noZeroAndNine) % mod)
	return

def __starting_point():
	solve()
__starting_point()


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


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


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


N = int(input())
print((10 ** N + 8 ** N - 9 ** N - 9 ** N) % 1000000007)


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


N = int(input())
a = 9 ** N
b = 8 ** N
c = 10 ** N
A = c - 2 * a + b
print(A % 1000000007)


N = int(input())
U = 10 ** N
x1 = U - 9 ** N
x2 = U - 8 ** N
Y = 2 * x1 - x2
print(Y % (10 ** 9 + 7))


num = int(input())
result = 2 * (10 ** num - 9 ** num) - (10 ** num - 8 ** num)
print(str(result % 1000000007))


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


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


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


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


import sys

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

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

def Li():
	return list(map(int, sys.stdin.readline().split()))
n = Ii()
num = 10
mod = 10 ** 9 + 7
ans = (pow(num, n, mod) - pow(num - 1, n, mod) - pow(num - 1, n, mod) + pow(num - 2, n, mod)) % mod
print(ans)


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


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


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


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


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


N = int(input())
if N == 1:
	print(0)
	return
ans = 10 ** N - 9 ** N - 9 ** N + 8 ** N
print(ans % (10 ** 9 + 7))


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


n = int(input())
A = 1000000007
x = 10 ** n - 2 * 9 ** n + 8 ** n
print(x % A)


n = int(input())
n_all = 10 ** n
n_e0 = 9 ** n
n_e9 = 9 ** n
n_e09 = 8 ** n
ans = (n_all - n_e0 - n_e9 + n_e09) % (10 ** 9 + 7)
print(ans)


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


N = int(input())
a = 10 ** N - 2 * 9 ** N + 8 ** N
b = 10 ** 9 + 7
print(a % b)


def f(N):
	return (10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7)
print(f(int(input())))


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


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


n = int(input())
mod = 10 ** 9 + 7
l = [8, 2, 0]
for i in range(n - 1):
	(a, b, c) = l
	l[0] = a * 8 % mod
	l[1] = (b * 9 + a * 2) % mod
	l[2] = (b + c * 10) % mod
print(l[2])


import math
ini = lambda : int(input())
inm = lambda : map(int, input().split())
inl = lambda : list(map(int, input().split()))
gcd = lambda x, y: gcd(y, x % y) if x % y else y

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

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

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()))
mod = 10 ** 9 + 7
n = ini()
ans = 10 ** n
ans -= 9 ** n * 2
ans += 8 ** n
print(ans % mod)


n = int(input())
a = 10 ** 9 + 7
b = 10 ** n % a - 2 * 9 ** n % a + 8 ** n % a
if b < 0:
	b += a
print(b)


def main():
	import sys
	input = sys.stdin.readline
	n = int(input())
	mod = 10 ** 9 + 7
	ans = pow(10, n, mod)
	ans -= pow(9, n, mod)
	ans -= pow(9, n, mod)
	ans += pow(8, n, mod)
	print(ans % mod)

def __starting_point():
	main()
__starting_point()


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


N = int(input())
A = 10 ** N + 8 ** N - 2 * 9 ** N
B = A % (10 ** 9 + 7)
print(B)


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


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


MOD = 10 ** 9 + 7

def an(a, n):
	ans = 1
	for i in range(N):
		ans = ans * a % MOD
	return ans % MOD
N = int(input())
A_n0 = an(9, N)
A_n0n9 = an(8, N)
ans = 10 ** N % MOD - (2 * A_n0 % MOD - A_n0n9)
print(ans % MOD)


def main():
	N = int(input())
	(all_non_zero, all_non_nine) = (9 ** N, 9 ** N)
	all_non_zeronine = 8 ** N
	any_zeronine = all_non_zero + all_non_nine - all_non_zeronine
	ans = 10 ** N - any_zeronine
	print(ans % (10 ** 9 + 7))

def __starting_point():
	main()
__starting_point()


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


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


import math
p = 10 ** 9 + 7
n = int(input())
print((10 ** n % p - 9 ** n % p - 9 ** n % p + 8 ** n % p) % p)


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


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


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


n = int(input())
mod = 10 ** 9 + 7
if n <= 1:
	print(0)
	return
print((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod)


def pow(a, x):
	if x == 0:
		return 1
	else:
		(y, r) = divmod(x, 2)
		sq = pow(a, y)
		if r == 1:
			return sq * sq * a % (10 ** 9 + 7)
		else:
			return sq * sq % (10 ** 9 + 7)

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


N = int(input())
x = 10 ** N
y = 2 * 9 ** N
z = 8 ** N
print((x - y + z) % (10 ** 9 + 7))


N = int(input())
ans = (10 ** N - 9 ** N - 9 ** N + 8 ** N) % int(1000000000.0 + 7)
print(int(ans))


def c178(n):
	ans = 0
	mod = 10 ** 9 + 7
	ans = 10 ** n - 2 * 9 ** n + 8 ** n
	return ans % mod

def main():
	n = int(input())
	print(c178(n))

def __starting_point():
	main()
__starting_point()


a = int(input())
b = 10 ** a - 2 * 9 ** a + 8 ** a
c = 10 ** 9 + 7
print(b % c)


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda : sys.stdin.readline().rstrip()
rs = lambda : sys.stdin.readline().split()
ri = lambda : int(sys.stdin.readline())
rm = lambda : list(map(int, sys.stdin.readline().split()))
rl = lambda : list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10 ** 9 + 7
n = ri()
print((10 ** n - 2 * 9 ** n + 8 ** n) % mod)


(N,) = map(int, input().split())
re = 0
re = 10 ** N - (2 * 9 ** N - 8 ** N)
print(re % (10 ** 9 + 7))


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


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


n = int(input())
waru = 1000000000 + 7

def kaijo(x, n):
	kake = 1
	for i in range(n):
		kake = kake * x % waru
	return kake
amari = kaijo(10, n) - 2 * kaijo(9, n) + kaijo(8, n)
amari %= waru
print(amari)


import numpy as np
base = 10 ** 9 + 7

def pw(x, n):
	if n == 0:
		return 1
	elif n == 1:
		return x
	else:
		return pw(x, n // 2) ** 2 % base * pw(x, n % 2) % base
n = int(input())
print((pw(10, n) - 2 * pw(9, n) + pw(8, n)) % base)


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


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


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

def __starting_point():
	main()
__starting_point()


N = int(input())
M = 10 ** 9 + 7
a = 10 ** N - 2 * 9 ** N + 8 ** N
print(a % M)


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


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


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


n = int(input())
m = 10 ** 9 + 7
u = pow(10, n, m)
a = (u - pow(9, n, m)) % m
b = (u - pow(8, n, m)) % m
ans = (a + a - b) % m
print(ans)


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


N = int(input())
sum = 10 ** N
sum -= 9 ** N
sum -= 9 ** N
sum += 8 ** N
print(sum % (10 ** 9 + 7))


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


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


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


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


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


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

def modpow(a, n, mod):
	res = 1
	while n > 0:
		if n & 1:
			res = res * a % mod
		a = a * a % mod
		n = n >> 1
	return res
ans = (modpow(10, n, mod) - modpow(9, n, mod) - modpow(9, n, mod) + modpow(8, n, mod)) % mod
print(ans)


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


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


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