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

ans = 10**N - (9**N + 9**N - 8**N)

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

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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) % MOD)

Submission status: Accepted

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

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()
dp = [[[0]*2 for _ in range(2)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
    for x in range(10):
        if x == 0:
            for j in range(2):
                dp[i+1][1][j] += dp[i][0][j]
                dp[i+1][1][j] += dp[i][1][j]
                dp[i+1][1][j] %= mod
        elif x == 9:
            for j in range(2):
                dp[i+1][j][1] += dp[i][j][1]
                dp[i+1][j][1] += dp[i][j][0]
                dp[i+1][j][1] %= mod
        else:
            for j in range(2):
                for k in range(2):
                    dp[i+1][j][k] += dp[i][j][k]
                    dp[i+1][j][k] %= mod
print(dp[-1][1][1])

Submission status: Accepted

Solution code:
# This code is generated by [Atcoder_base64](https://github.com/kyomukyomupurin/AtCoder_base64)
# Original source code : 

"""
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

#define all($) begin($), end($)
#define rall($) rbegin($), rend($)

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
  #ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
  #else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
  #endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& MOD = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int MOD = (int) 1e9 + 7;
using Mint = Modular<std::integral_constant<std::decay<decltype(MOD)>::type, MOD>>;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;
  // 10^n - 9^n - 9^n + 8^n
  Mint ans = power((Mint)10, n) - power((Mint)9, n) - power((Mint)9, n) + power((Mint)8, n);
  cout << ans << endl;

  return 0;
}

"""

import base64
import subprocess
import zlib


exe_bin = "c%1E9eQ*=U6<<mI#+C&!!9b`lu1W0#6bo!H5EILm;FK8S+Hy)h;E*L5UyvnNI)Tlk4Z(qlVw^Z_$}nx(A!(9HJ4s7sI-NFU8dFn9I-MzW(xfv<TH1zIrb**`5kiX9w|BdzyVYHjw)vxfcxU9d@3-&0{d&81yZ3yzw|#@vVnH<7(0YV9u0-Km2!3RlDgsy&Du%yH&{e1a_&kjqOD|gVv`DQ-(QC3QJWH=adTP<od}N-E+VvEAqUzzcZeOCH+m~=UdX&`5<?HpVL~n@b4H0=t5z(WR_Aih8`~+vI2kB`Zp`GWX5YCsDDLhNtk)Be$FM?hH`t->`Xcwu^Y+R0z_EJjc;rfW!yQ<;(NN9OPj3$Sc4>he?zN*2Qh&fltZE_IVjU7F*Jf3elRJgo?V7UBe-@5w`k5;{M_Y=RVp1ZwjOZ8tKZ|uaf<tRIEV9{y;&2nO+;&5qO;!q(qnUhY!Z=M0(0tTxM@H<W9dra`97Gr#+30`4>r%mi{H^HkA^-O)*Y+~PGBEQZA|A9%pcp~PaO4PzBS`Oj}Pap-~ezk&EQU?M5NJydJb=P5^ScL>($3QG9B&0xG5(Fgp{F{VOI3C_1CZurOzo{(}i-!Gy-bh#}GcLKUqg#w8yj`N4jYSe(oa>ev!qHH~7wnc?u3&#4E=ci!C?$MBueS@ZmA!$47!+a&DIN|C`22#uUhsCW5@gktK`|;@lbXa>LIBZlgD)yd9+!6)gS#3N!_lCyTa@~tBOx*7?KRSDQ#7Gf!B|ql0}-TS0NoGn6oUObg}#6o0U(e_gkeAk7aR%*0VzBrN`&bXqk)LH2YN1GGi3M%0?_1*?Y`DFVTH3n&8=`YD)}v2gq46Jyy9%|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z!$#1bzHH{Q{gtsXjdiQCdrIdaPlO4IM~1tE=a4tDYVv9mdBTi$<TGt8YR2*j;+AqI85AFn0X5A?2)1_38PGQu;1N+s}kkqn$`OyQ{~%0zK{2uvV1Y|2;?<Q>stTbClBi1a|yr|L-OGt%RrNK1wGv?Z47M{{f_pVb0#?P)hGTXkzC-#pu&>B&Fkwyn~?+Gy3$rNhv#CMGXBmqfg(1Dcz?HRz&((N1VRP=+pOEN{bnJw*TKl`t?iS^C`Wbk>?oxSw`P1p5Cnf=NWx^ZdNJd@a%ZLh?ICyI!xL4dWC1liyi;pAtkPq>eKVp;1c8dSp7dCW$e}aIQ9P*2tYbk!06F-9Y#w3+55bqDuuuA6Y4+D=&R=hPG1kJPt!EPsJ?psAo?xL{Z9*{{{g9=y|AMCbqsEFFKZNk)I#)|$UcCdGftGd{);tj*QTK_kop;iWB1RwCi;((1KtdSv-<x6Msaii"

open("./kyomu", 'wb').write(zlib.decompress(base64.b85decode(exe_bin)))
subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
import copy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


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

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


def main():
    n = I()
    # print((pow(10, n) - (pow(9, n) + pow(9, n) - pow(8, n))) % mod)
    print((pow(n, 10) - (pow(n, 9) + pow(n, 9) - pow(n, 8))) % mod)
    # ans = 0
    # now = 0
    # for i in range(n):

    #     for j in range(10):


def pow(n, num):
    s = num
    for i in range(1, n):
        s = s * num % mod
    return s

# def pow(a, n):
#     x = 1
#     while n > 0:
#         if(n & 1):
#             x *= a
#         a = a*a
#         n >>= 1
#     return x


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = input()
M = int(N)

A = 9**M
a = int(A)
B = 9**M
b = int(B)
C = 8**M
c = int(C)
D = a+b-c
d = int(D)
E = 10**M
e = int(E)
F = e-d
f = int(F)

if M==0:
    print(0)

elif M==1:
    print(0)

elif M==2:
    print(2)

elif M>=3:
    print(f%(10**9+7))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int):
    return print((10**N - 2*9**N + 8**N)%MOD)

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

MOD = 10**9 + 7

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

Submission status: Accepted

Solution code:
n = int(input())
p = 10 ** 9 + 7
a = 1
b = 1
c = 1
for i in range(n):
    a = (a * 10) % p
    b = (b * 9) % p
    c = (c * 8) % p
y = a - 2 * b + c
if y < 0:
    while y < 0:
        y += p
elif y > p:
    while y > p:
        y -= p
print(y)

Submission status: Accepted

Solution code:
n = int(input())

a=pow(10,n,10**9+7)
b=pow(9,n,10**9+7)
c=pow(8,n,10**9+7)
print((a-2*b+c)%(10**9+7))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C
N = int(input())
nasi = 10**N - 9**N - 9**N + 8**N
wari = 10**9 + 7
ans = nasi % wari
print(ans)

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))%Mod)

Submission status: Accepted

Solution code:
N = int(input())

mod = 10**9+7

def pwmod(x, y):
    res = 1
    for i in range(y):
        res = res * x % mod
    return res

ans = pwmod(10, N) - pwmod(9, N) - pwmod(9, N) + pwmod(8, N)
ans = ans % mod

print(ans)

Submission status: Accepted

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

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

All = 10**n % mod
other = (9**n % mod) + (9**n % mod) - (8**n % mod)
print((All - other) % mod)

Submission status: Accepted

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

ans = pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)
if ans < 0:
  while ans < 0:
    ans += mod
else:
  ans %= mod

print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

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

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





'''
# Wrap solution for more recursion depth
#submit as python3
import collections,sys,threading
sys.setrecursionlimit(10**9)
threading.stack_size(10**8)



threading.Thread(target=solve).start()
'''

Submission status: Accepted

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

n10 = pow(10, n, mod)
n9 = pow(9, n, mod)
n8 = pow(8, n, mod)
ans = 2 * (n10 - n9) - (n10 - n8)
ans %= mod

print(ans)

Submission status: Accepted

Solution code:
def c_ubiquity(MOD=10**9 + 7):
    N = int(input())
    def calc(k): return pow(k, N, MOD)
    return (calc(10) - 2 * calc(9) + calc(8)) % MOD

print(c_ubiquity())

Submission status: Accepted

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, factorial
from copy import deepcopy
 
def main():
    n = int(input()) 
    ans = (10**n) - 2*(9**n) + (8**n) 
    print(ans%(10**9+7))
    

if __name__ == "__main__":
    main()

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))%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

mod = 10 ** 9 + 7

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#import sys
#input = sys.stdin.readline
Q = 10**9+7
def main():
    N = int( input())
    ans = pow(10, N, Q) - pow(9, N, Q)*2 + pow(8, N, Q)
    print( ans%Q)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

mod = 10 ** 9 + 7

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

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

Submission status: Accepted

Solution code:

def resolve():
    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)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

d = 1
q = 1
o = 1
for i in range(n):
  d = (d * 10) % m
  q = (q * 9) % m
  o = (o * 8) % m

print((d-q-q+o)%m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


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


def MF(): return map(float,input().split())


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


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	n=II()
	a=pow(10,n,10**9+7)
	b=pow(9,n,10**9+7)
	c=pow(8,n,10**9+7)
	print((a-2*b+c)%(10**9+7))
	

if __name__=="__main__":
	main()

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9 + 7
if N < 2:
    print(0)
    exit()
all = pow(10, N, mod)

sabun = pow(9, N, mod) * 2 - pow(8, N, mod)
ans = ((all % mod) - sabun) % mod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
MOD = 1000000007
a,b,c,d=pow(9,n,MOD),pow(9,n,MOD),pow(8,n,MOD),pow(10,n,MOD)
print((d-a-b+c+MOD)%MOD)

Submission status: Accepted

Solution code:
N = int(input())
mod = 10**9 +7
def fur(n,r):
    p,q = 1,1
    for i in range(r):
        p = p*(n-i)%mod
        q = q*(i+1)%mod
    return p * pow(q,mod-2,mod) % mod
ans = (10**N) - (-8**N +9**N + 9**N)
print(int(ans%mod))

Submission status: Accepted

Solution code:
mod = int(1e9+7)
n = int(input())
ans1 = 1
ans2 = 1
ans3 = 1
for i in range(n):
    ans1 *= 10
    ans1 %= mod
    ans2 *= 9
    ans2 %= mod
    ans3 *= 8
    ans3 %= mod

ans = ans1 - 2*ans2 + ans3

print(ans%mod)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
TEN = 1
NINE = 1
EIGHT = 1
a = 10
b = 9
c = 8

mod = 10 ** 9 + 7

for i in range(64):
    if N % 2:
        TEN *= a
        TEN %= mod
        NINE *= b
        NINE %= mod
        EIGHT *= c
        EIGHT %= mod
    N //= 2
    a *= a
    a %= mod
    b *= b
    b %= mod
    c *= c
    c %= mod

print((TEN - 2 * NINE + EIGHT + mod * 2)%mod)

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math

N = int(input())

ans =  (10**N) - 9**N - 9**N + 8**N
ans = ans % ((10**9)+7)
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())
# 0が含まれない組み合わせ 9^N
# 9が含まれない組み合わせ 9^N
# 0も9も含まれない組み合わせ 8^N
# ベン図より、0か9どちらか少なくとも一方が存在しないような組み合わせは 9^N + 9^N - 8^N
# 全体の組み合わせは 10^N
# 答えは 10^N - 9^N - 9^N + 8^N
MAX = 10 ** 9 + 7
result = pow(10, N, MAX) - pow(9, N, MAX) - pow(9, N, MAX) + pow(8, N, MAX)

print(result % MAX)

Submission status: Accepted

Solution code:
MOD = 1000000007
def powmod(x, y):
  res = 1
  for i in range(y):
    res = res * x % MOD
  return res

n = int(input())
ans = powmod(10, n) - powmod(9, n) - powmod(9, n) + powmod(8, n)
ans = ans % MOD
ans = (ans + MOD) % MOD
print(ans)

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
from functools import reduce
from operator import mul
from typing import Callable, ClassVar, Sequence, Type, TypeVar


T = TypeVar('T', bound='ModIntBase')


class ModIntBase:
    value: int
    mod: ClassVar[int]
    fac: ClassVar[Sequence[int]] = ()
    inv: ClassVar[Sequence[int]] = ()
    finv: ClassVar[Sequence[int]] = ()

    def __init__(self, value: int) -> None:
        self.value = value % self.mod

    def __hash__(self) -> int:
        return hash((self.value, self.mod))

    def __eq__(self, other) -> bool:
        if isinstance(other, self.__class__):
            return self.value == other.value
        else:
            return NotImplemented

    def __ne__(self, other) -> bool:
        if isinstance(other, self.__class__):
            return self.value != other.value
        else:
            return NotImplemented

    # TODO: Add type hints
    def __add__(self, other):
        if isinstance(other, self.__class__):
            return self.__class__((self.value + other.value) % self.mod)
        else:
            return NotImplemented

    def __sub__(self, other):
        if isinstance(other, self.__class__):
            return self.__class__((self.value - other.value) % self.mod)
        else:
            return NotImplemented

    def __mul__(self, other):
        if isinstance(other, self.__class__):
            return self.__class__(self.value * other.value % self.mod)
        else:
            return NotImplemented

    def __truediv__(self, other):
        if isinstance(other, self.__class__):
            a = other.value
            b = self.mod
            u = 1
            v = 0
            while b:
                t = a // b
                a, b = b, a - t * b
                u, v = v, u - t * v
            return self.__class__(self.value * u % self.mod)
        else:
            return NotImplemented

    def __pow__(self, other):
        if isinstance(other, self.__class__):
            v = 1
            a = self.value
            b = other.value
            mod = self.mod
            while b > 0:
                if b & 1:
                    v = v * a % mod
                a = a * a % mod
                b >>= 1
            return self.__class__(v)
        else:
            return NotImplemented

    @classmethod
    def comb(cls, n: int, k: int):
        if n < k:
            return cls(0)
        if n < 0 or k < 0:
            return cls(0)

        if n < len(cls.fac):
            return cls(cls.fac[n] * (cls.finv[k] * cls.finv[n - k] % cls.mod) % cls.mod)
        else:
            k = min(k, n - k)
            a = reduce(mul, map(cls, range(n - k + 1, n + 1)), cls(1))
            b = reduce(mul, map(cls, range(1, k + 1)), cls(1))
            return a / b

    def __repr__(self) -> str:
        return f'{self.__class__.__name__}({self.value!r})'

    def __str__(self) -> str:
        return str(self.value)


def mod_comb_init(max_: int) -> Callable[[Type[T]], Type[T]]:
    def _mod_comb_init(cls: Type[T]) -> Type[T]:
        mod: int = cls.mod
        assert max_ < mod

        fac = cls.fac = [0] * max_
        finv = cls.finv = [0] * max_
        inv = cls.inv = [0] * max_

        fac[0] = fac[1] = 1
        finv[0] = finv[1] = 1
        inv[1] = 1
        for i in range(2, max_):
            fac[i] = fac[i - 1] * i % mod
            inv[i] = mod - inv[mod % i] * (mod // i) % mod
            finv[i] = finv[i - 1] * inv[i] % mod

        return cls
    return _mod_comb_init


class ModInt(ModIntBase):
    mod = 1000000007  # 10 ** 9 + 7


def resolve(in_):
    N = int(next(in_))

    a = ModInt(10) ** ModInt(N)
    b = ModInt(9) ** ModInt(N)
    c = ModInt(8) ** ModInt(N)

    ans = a - b * ModInt(2) + c
    return ans
    

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())

mod=pow(10,9)+7

def pow_method(r,N):
    ans=1
    for i in range(N):
        ans=ans*r%mod
    return ans

calc=pow_method(9,N)+pow_method(9,N)-pow_method(8,N)
ans=pow_method(10,N)-calc
ans=ans%mod
ans=(ans+mod)%mod

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 解説AC
import math

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

ans = (10 ** N) % MOD - (9 ** N) % MOD -(9 ** N) % MOD + (8 ** N) % MOD
while ans < 0: ans += MOD

print(ans % MOD)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = int(input())

if N==1:
    out=0
elif N==2:
    out=2

else:
    out=(10**N - (9**N + 9**N - 8**N)) % (10**9 + 7)

print(out)