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: Wrong Answer

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

    p = int(1e9) + 7
    N = 10 ** 6  # N は必要分だけ用意する
    fact = [1, 1]
    factinv = [1, 1]
    inv = [0, 1]
    
    com = n*(n-1)
    exp = 8**(n-2)
        
    def cmb(n, r, p):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p

    sum = 0  
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
        
    for i in range(1, n):
        sum += cmb(n,i,p)


    print(int(com*exp+(sum*min(1,max(0,n-2)))) % p)
    
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n = int(input())
if n == 1:
    print(0)
else:
    print(((n**2)-2)%10000000007)

Submission status: Wrong Answer

Solution code:
N=int(input())

if N<2:
	print(0)

else:
	without=10**(N-2)
	each=N*(N-1)
	final=without*each

	considered=final%(10**9+7)

	print(considered)

Submission status: Wrong Answer

Solution code:
N=int(input())

a=2**N-2
MOD=10**9+7

p=1
b=0
import math
for i in range(1,N):
    p=(math.factorial(N))/math.factorial((N-i))
    b=p*8+(2**(N-i)-2)%MOD
ans=a+b%MOD
print(int(ans))

Submission status: Wrong Answer

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

if n == 1:
  print(0)
elif n == 2:
  print(2)
else:
  ans = pow(10,n-2)
  print(ans%n)

Submission status: Wrong Answer

Solution code:
N=2

if N<2:
	print(0)
elif N==2:
	print(2)
else:
	without=10**(N-2)
	each=N*(N-1)
	final=without*each

	considered=final%(10**9+7)

	print(considered)

Submission status: Wrong Answer

Solution code:
def bigmod(v, n10, m):
    """
    >>> bigmod(1, 2, 9)
    1
    >>> bigmod(2343413, 10, 100005)
    1
    """
    # print((v*10.**n10) % m)
    v %= m
    while n10>0:
        v *= 10
        n10 -= 1
        v %= m
    return v

def main():
    n = int(input())
    m = int(10**9+7)
    a = bigmod(n*(n-1), n-2, m)

    print(a)

main()

Submission status: Wrong Answer

Solution code:
def powmod(a,n,mod):
    ans = 1
    while n > 0:
        if n & 1:  # nの2進数表示の末尾が1か
            ans = ans * a % mod
        a = a ** 2 % mod  # aを2乗する
        n >>= 1  # nを2で割る
        #print(ans,a,n)
    return ans

#2分累乗法　ばらして余りとってかけ算
N=int(input())
m=10**9+7
L=[powmod(10,N,m),powmod(9,N,m),powmod(9,N,m),powmod(8,N,m)]
A=L[0]+L[3]-(L[1]+L[2])
if A<0:
    A+=m
print(A)

Submission status: Wrong Answer

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

if n == 1:
  print(0)
elif n == 2:
  print(2)
else:
  ans = pow(9,n-2)
  print(ans%n)

Submission status: Wrong Answer

Solution code:

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

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    print((10**n%mod)-(8**n%mod))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    if n==1:
        ans = 0
    elif n==2:
        ans = 2
    else:
        ans = 2
        for i in range(3, n+1):
            all = 10 ** (i-1)
            if(all>1000000007):
                all %= 1000000007
            ans = ans*10 + (all-ans)*2
            if(ans>1000000007):
                ans %= 1000000007

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

mod = 10**9+7
if N == 1:
  result = 0
else:
  result = (10**(N-2) * 2) % mod

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print((comb(4,2)*2*9**N)%(10**9+7))

Submission status: Wrong Answer

Solution code:
f = []
def precompute():
    f.append(1)
    for i in range(1,10**6+1):
        f.append((f[i-1]*i)%m)
def ncr(n,r):
    return f[n]*pow(n-r,m-2,m)*pow(r,m-2,m)
    
n,m = int(input()),int(1e9+7)
precompute()
x = pow(10,n,m)%m
y = pow(8,n,m)%m
z = 1
for i in range(1,n):
    z += ncr(n,i)*pow(8,n-i,m)
print((x-(y+z+z))%m)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
# a, b, c, d = map(int,input().split())

n = int(input())

ret = ((8 ** (n - 2)) * 2) * ((n * (n - 1)) // 2)

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

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
if n < 2:
  print(0)
  exit()
combs = ((n+7)*(n+6)*(n+5)*(n+4)*(n+3)*(n+2)*(n+1)*(n)*(n-1))/(9*8*7*6*5*4*3*2)
combs *= (n-1)*n
print(int(combs % (10**9 + 7)))

Submission status: Wrong Answer

Solution code:
import math
import itertools
n=int(input())
if n>=3:
  #0の数が増え,9の数が減る
  ans=0
  if n%2==1:
    Range=n-1//2
  else:
    Range=n//2
  for i0 in range(1,Range):
    i9=n-i0
    ans+=len(set(itertools.permutations([0]*i0+[9]*i9)))*2
  print((n*8*(n-2)*2+ans) % ((10**9)+7))
elif n==2:
  print(2)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
import math
MOD = 10**9 + 7

def mod_pow(x, mod):
    xx = [1, x]
    def _pow(y, x=x):
        nonlocal xx
        if y == 0:
            return 1
        while len(xx) <= math.log(y, 2)+1:
            v = xx[-1] * xx[-1]
            v %= mod
            xx.append(v)
        i = 1
        result = 1
        while y > 0:
            if y % 2 == 1:
                result *= xx[i]
                result %= mod
            y = y >> 1
            i += 1
        return result
    return _pow

pow10 = mod_pow(10, MOD)
pow9 = mod_pow(9, MOD)
pow8 = mod_pow(8, MOD)

def f(n):
    ans = pow10(n) - (2 * pow9(n) - pow8(n))
    return ans


def main():
    N = int(input())
    ans = f(N)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce

N = int(input())

MOD = 10**9+7
if N == 1:
    print(0)


def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res

a = power_func(10, N, MOD)
b = power_func(8, N, MOD)
c = power_func(9, N, MOD)
print((a+b+(-2)*c)%MOD)

Submission status: Wrong Answer

Solution code:
#0~9の箱を用意して、区別のあるN個の玉を入れていく
#0と9の両方に玉が入らない場合の数は8**N通り
#0に1個以上玉が入っていて、9に玉が入っていない場合の数は9**N-8**N
#9に1個以上玉が入っていて、0に玉が入っていない場合の数は9**N-8**N
#ただし、N=1のときは例外的に0
N=int(input())
if N==1:
    print(0)

def power(x,n):    #xが基数
    k=1
    while n>1:
        if n%2!=0:
            k*=x
        x*=x
        n//=2
    return k*x
        

total=power(10,N)+power(8,N)-2*power(9,N)
print(total%(power(10,9)+7))

Submission status: Wrong Answer

Solution code:

n = int(input())
mod = (10**9)+7
n_all = 10**(n) % mod
bad_0 = 9**(n)%mod
bad_9 = 9**(n)%mod
bad_18 = 8**(n)%mod

print(n_all-bad_0-bad_9+bad_18)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n = int(input())
mod = 1000000007

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K = K%mod
        x *= x
        x = x%mod
        n = n//2
        n = n%mod

    return (K * x)%mod
    
def f(i):
    return pow_k(9, i) * pow_k(10, n-2-i)

def sigma(func, frm, to):
    result = 0; #答えの受け皿
    for j in range(frm, to+1):
        result += func(j) % mod
        #ここで関数を呼び出す。ちなみにここではj = x
    return result

ss = sigma(f, 0, n-2) #22
print((ss*2)%mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""
task statement
==============

長さ N の整数の列 A_1,A_2,\ldots,A_N であって以下の条件をすべて満たすものはいくつありますか。

0 \leq A_i \leq 9
A_i=0 なる i が存在する。
A_i=9 なる i が存在する。

ただし、答えはとても大きくなる可能性があるので、10^9+7 で割った余りを出力してください。

io_style
-------
N
"""
import sys
# sys.setrecursionlimit(100000)


def egcd(a: int, b: int):
    """extended gcd"""
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y


def mod_inv(a, mod=10**9 + 7):
    """mod inversion """
    g, x, y = egcd(a, mod)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % mod


def mod_combination(n, r, mod=10**9 + 7) -> int:
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * mod_inv(i + 1, mod) % mod
    return res


def mod_pow(x, n, mod=10**9 + 7) -> int:
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K %= mod
        x *= x
        x %= mod
        n //= 2

    return (K * x) % mod


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


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    if n == 1:
        print(0)
        return
    MOD = 10**9
    ans = mod_pow(10, n) - mod_pow(9, n) - mod_pow(9, n) + mod_pow(8, n)
    print(ans % MOD)
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import itertools as it

n = int(input())
if n == 1:
    ans = 0
r = n-2

if n != 1:
    combo0 = list(map(list,it.combinations_with_replacement([0,1,2,3,4,5,6,7,8,9], r)))
    l = len(combo0)
    for i in range(l):
        combo0[i].append(0)
        combo0[i].append(9)
    x = 0
    for j in range(l):
        y = len(list(map(list, it.permutations(combo0[j]))))
        x = x + y

    z = 10**9 + 7
    ans = x % z

print(ans)

Submission status: Wrong Answer

Solution code:
MOD=10**9+7
lim=200000
inv_t = [-1 for i in range(lim+1)]
factrial = [-1 for i in range(lim+1)]
factrial_inv = [-1 for i in range(lim+1)]


def mod_inv(x, mod=MOD):
    y, u, v, _x = mod, 1, 0, x
    while y:
        t = _x//y
        _x -= t*y
        _x, y = y, _x
        u -= t*v
        u, v = v, u
    u %= mod
    if u < 0:
        u += mod
    return u

def mod_pow(a, n, mod=MOD):
    res = 1
    while n:
        if n & 1:
            res = res*a % mod
        a = a*a % mod
        n >>= 1
    return res

def COMinit(max=lim, mod=MOD):
    factrial[0] = factrial_inv[0] = 1
    factrial[1] = factrial_inv[1] = 1
    inv_t[0] = inv_t[1] = 1
    for i in range(2, max):
        factrial[i] = factrial[i-1]*i % mod
        inv_t[i] = -inv_t[mod % i]*(mod//i) % mod
        factrial_inv[i] = factrial_inv[i-1]*inv_t[i] % mod

def comb(a, b, mod=MOD):
    if a<b:
        return 0
    if factrial[0] == -1:
        COMinit()
    return (factrial[a]*factrial_inv[b]*factrial_inv[a-b]) % mod


n=int(input())
ans=mod_pow(10,n)

nine=mod_pow(9,n)
ei=mod_pow(8,n)


print(ans-ei-(nine-ei)*2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

num1 = 10**n % (10**9 + 7)
num2 = (9**n * 2) % (10**9 + 7)
num3 = 8**n % (10**9 + 7)

print(num1 - num2 + num3)

Submission status: Wrong Answer

Solution code:
import math
from scipy.special import comb
mod = 1000000007
N = int(input())

def Solve(N, n, r):
  ans = comb(N, 2, exact=True)*2
  for i in range(r):
    ans = ans * (n - i) % mod
  return ans
  
print(Solve(N,10*(N-2),N-2))

Submission status: Wrong Answer

Solution code:
p = int(1e9)+7
N = int(input())
c = 1
for i in range(N):
    c = (c*10)%p
d = 1
for i in range(N):
    d = (d*9)%p
e = 1
for i in range(N):
    e = (e*8)%p
print(c-(d*2-e))

Submission status: Wrong Answer

Solution code:
import math

MOD = 100000007
n = int(input())
ans = (10 ** (n - 2))
for i in range(n, 0, -1):
	ans *= i
ans -= n * (n - 1) * (n - 2) * (n - 3)
ans %= MOD
print(ans)

Submission status: Wrong Answer

Solution code:
def power_func(a,n,p):
    bi = str(format(n,"b"))
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res
N = int(input())
answer = power_func(10,N,pow(10,9) + 7) + power_func(8,N,pow(10,9) + 7) - 2 * power_func(9,N,pow(10,9) + 7)
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())

num1 = 10**n % (10**9 + 7)
num2 = 9**n % (10**9 + 7)
num3 = 8**n % (10**9 + 7)

print(num1 - num2 * 2 + num3)

Submission status: Wrong Answer

Solution code:
n = int(input())

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

x = p(10, n) - 2*p(9, n) + p(8, n)
if x < 0:
    x += 10 ** 9 + 7
elif x == 10 ** 9 + 7:
    x = 0
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())

x = 0
i = 0

k = n-2

l = [(i+1)*((9**i) * 10**(k-i)) for i in range(k+1)]
"""
while(k>=i):
  x += (i+1)*((9**i) * 10**(k-i))
  i += 1

x *= 2
"""
x = sum(l)
x *= 2
print(x%(10**9 + 7))

Submission status: Wrong Answer

Solution code:
s = int(input())
ans = (s * (s - 1)) % 1000000007
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n = int(input())
a = ["0","9","x"]

if n == 1:
  print(0)
elif n == 2:
  print(2)
else:
  count = 0
  for v in itertools.product(a, repeat=n):
    l = list(v)
    if "0" in l and "9" in l and "x" in l:
      count += 9**l.count("x")
  print(count%(10**9+7))

Submission status: Wrong Answer

Solution code:
n=int(input())
den = 10**9+7
a= ((n%den)*((n-1)% den))%den
i=1 
for _ in range(n-2):
	i =(i*10)%den
res=(a*i)% den
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

mod = (10**9) +7

a=pow(10,n)
b=pow(8,n)
c=2*n*pow(8,n-1)

ans=(a-b-c-2)%mod

print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
summ = 0
mod = 10 ** 9 + 7
sigma = 0

def comb_count(n, r, a):
    return math.factorial(n) // \
    (math.factorial(n - r) * math.factorial(a) * math.factorial(r - a))


for i in range(2, n + 1):
    for t in range(1, i):
        z = comb_count(n, i, t)
        sigma += z

    summ = summ + (sigma * 8 ** (n - i))
    summ = summ % mod

print(summ)

Submission status: Wrong Answer

Solution code:
N = input()
x = int(N)
y = x*(x-1)*(10**(x-2))
z = y % (10^9+7)
print(z)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 1
MOD = 1000000007
for i in range(N):
    count *= 2
    count = count % MOD
count -= 2
print(count)

Submission status: Wrong Answer

Solution code:
def powmod(a,n,mod):
    ans = 1
    while n > 0:
        if n & 1:  # nの2進数表示の末尾が1か
            ans = ans * a % mod
        a = a ** 2 % mod  # aを2乗する
        n >>= 1  # nを2で割る
        #print(ans,a,n)
    return ans

#2分累乗法　ばらして余りとってかけ算
N=int(input())
m=powmod(10,N,1000000007)-powmod(9,N,1000000007)-powmod(9,N,1000000007)+powmod(8,N,1000000007)
print(m)

Submission status: Wrong Answer

Solution code:
N =int(input())
if ( N==1):
    print(0)
if(N>=2):
    a=N*(N-1)*(10**(N-2))
    print(a%(10^9+7))

Submission status: Wrong Answer

Solution code:
#import math
import itertools
n = int(input())
l = list(range(0, n, 1))
#print(l)
def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)
#print(len(list(itertools.permutations(l, 2))))
#%(10^9 + 7)した答えを出力
mas = n-2 # 0と9は必ず使う
if mas == 0:
  print(2)
elif n == 0:
  print(1)
else:
  #res = (permutations_count(n, 2) * 10^mas)%(10^9 + 7)
  res = (len(list(itertools.permutations(l, 2)))%(10^9 + 7)) * (10^mas%(10^9 + 7))
  print(res)

Submission status: Wrong Answer

Solution code:
N = input()
x = int(N)
a = x-1
b = 10**(x-2)
y = x*a*b
z = y % (10^9+7)
print(z)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
from scipy.special import comb
a = int(input())
mod = 10**9 + 7
x = comb(a, 2, exact=True)
if a <= 1:
    print(0)
    exit(0)
elif a == 2:
    print(2)
    exit(0)

else:
    s = x*2 * (10**(a-2)) % mod
    print(s)

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
print((math.factorial(n) * (10 ** (n - 2) - 1)) % ((10 ** 9) + 7))

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":

    N=int(input())

    a = N * (N-1) * 10 ** (N-2)
    a = a  % (10 ** 9 + 7)

    print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

x = p(10, n) - 2*p(9, n) + p(8, n)
if x < 0:
    x += 10 ** 9 + 7
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())
res = 0
mod = (10**9+7)
from scipy.special import perm
from scipy.special import comb
# a = comb(n, r)
a = perm(n,2)
b = 10**(n-2) % mod
res = int(((a * b) % mod))


# res = a + b - c
print(res)

Submission status: Wrong Answer

Solution code:
from math import factorial
mod = 10**9+7

n = int(input())

if n==1:
  print(0)
  exit()
  
if n==2:
  print(2)
  exit()
  
a = factorial(n)
a = a*(9**(n-2))
print(a%mod)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

def permutations_count(n, r):
    return math.factorial(n) //( math.factorial(n - r) * math.factorial(r))

ans = 0
if N == 1:
    ans = 0
elif N == 2:
    ans = 2
else:
    for r in range(1,N,1):
        ans = (ans + permutations_count(N, r)) % (10**9 + 7)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    print(0)

mod = 10 ** 9 + 7

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

mod = 10**9+7
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]

def init(n):
    for i in range(2, n + 1):
        fac.append(fac[-1] * i % mod)
        inv.append(-inv[mod % i] * (mod // i) % mod)
        finv.append(finv[-1] * inv[-1] % mod)


def com(n, k, mod):
    if n < 0 or k < 0 or n < k:
        return 0
    return  (2 * (N-2) * 10 * fac[n] * (finv[k] * finv[n - k] % mod)) % mod

init(N)

if N == 1:
    print(0)
elif N == 2:
    print(2)
else:
    print(com(N, 2, mod))

Submission status: Wrong Answer

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

ans = (N * (N - 1) * 8 ** (N - 2)) % M
print(ans)

Submission status: Wrong Answer

Solution code:
from math import factorial
mod = 10**9+7

n = int(input())

if n==1:
  print(0)
  exit()
  
if n==2:
  print(2)
  exit()
  
a = factorial(n)
a = a*(9**(n-2))
print(a%mod)

Submission status: Wrong Answer

Solution code:
import sys
import itertools

N = int(input())
a = N * (N-1)


# a %= 10 ** 9 + 7

a *= (10**(N-2))

a %= 10 ** 9 + 7
print(a)

Submission status: Wrong Answer

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

print(((2**n) - 2) % MOD)

Submission status: Wrong Answer

Solution code:
import sys
import itertools

N = int(input())
a = N * (N-1)


# a %= 10 ** 9 + 7
print(a)

a *= (10**(N-2))

a %= 10 ** 9 + 7
print(a, N-2)

Submission status: Wrong Answer

Solution code:
n = int(input())

x = 0
i = 0

k = n-2

while(k>=i):
  x += (i+1)*((9**i) * 10**(k-i))
  i += 1

x *= 2

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

Submission status: Wrong Answer

Solution code:
import numpy as np

m = 1e9+7

N = int(input())

print(type(N))

def culc_mod(a, b, md):
    """a^b (mod md)"""
    tmp = 1
    for _ in range(b):
        tmp *= a
        tmp = tmp%md
    return tmp
    
a = culc_mod(10, N, m)
b = culc_mod(9, N, m)
c = culc_mod(8, N, m)

print(int((a-2*b+c)%m))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
if 1 < n:
    ans = (n*(n-1))%int(1e9+7)
    for i in range(n-2):
        ans *= 10
        ans %= int(1e9+7)
    print(ans)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())

a=1
b=1
for i in range(n):
  a*=10
  a = a % (10**9 + 7)
  b*=8
  b=b%(10**9+7)

ans=(a-b)%(10**9+7)

print(ans)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
n = int(input())
mod = 1000000007
def f(i):
    return 9**i * 10**(n-2-i)  

def sigma(func, frm, to):
    result = 0; #答えの受け皿
    for j in range(frm, to+1):
        result += func(j) % mod
        #ここで関数を呼び出す。ちなみにここではj = x
    return result

ss = sigma(f, 0, n-2) #22
print((ss*2)%mod)

Submission status: Wrong Answer

Solution code:
N = int(input())

mod = 10 ** 9 + 7
nn = 10 ** N % mod
nm = 2 * (9 ** N) % mod - (8 ** N) % mod

print(nn - nm)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n < 2:
  print(0)
elif n == 2:
  print(2)
else:
  amari = n - 1
  
  full = 9 * 10 ** amari
  ex = 8 ** n
  
  ans = (full - ex) % (100000000+7)
  
  print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

if (n <= 10):
    print(pow(10, n) - pow(8, n))
else:
    print(pow(10, 10) - pow(8, 10))

Submission status: Wrong Answer

Solution code:
N = int(input())

mod = 10 ** 9 + 7
nn = 10 ** N % mod
nm = (2 * 9 ** N) % mod - (8 ** N) % mod

print(nn - nm)

Submission status: Wrong Answer

Solution code:
n = int(input())

mod = int(1e9+7)
ans = n*(n-1)*(10**n-2)%mod
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

Num = N * (N-1) * 10 **(N-2)
Answer = Num %(1000000007)
print(Answer)

Submission status: Wrong Answer

Solution code:

import math

N=int(input())

if(N==1):
    print(0)
else:
    a=10**(N-2)
    b=math.factorial(N) //  math.factorial(N-2)
    c=b*a
    if(c>10**9+7):
        c1=c%10**9+7
        print(c1)
    else:
        print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())
def count_row(n):
    a = n * (n-1) * 10 ** (n-2)
    a %= 10 ** 9 + 7
    return a
b = int(count_row(n))
print(b)

Submission status: Wrong Answer

Solution code:
n=int(input())
import math
def cc(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if n<2:
  print(0)
elif n==2:
  print(2)
else:
  cc_=cc(n,2)
  ans=cc_ * 9 * 2
  print(ans%(10**9+7))

Submission status: Wrong Answer

Solution code:

def main():
    n = int(input())
    # a, b, c, d = map(int, input().split())
    # l = list(map(int, input().split()))
    # s = input()
    print((10**n - 9**n) * 2 % (10**9 + 7) - (10**n-8**n) % (10**9 + 7))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
if n == 1:
    print(0)
else:
    print(10**(n-2)*(math.factorial(n))%(10**9+7))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

mod = 1000000007

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

n = int(input())
if n == 1:
    print(0)
else:
    print(mul(cmb(n,2),2))

Submission status: Wrong Answer

Solution code:
n = int(input())

def p(m, n):
    k = 1
    for i in range(n):
        k = (k * m) % (10**9 + 7)
    return k

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
MOD = 10 ** 9 + 7
MAX = 10 ** 6 + 1000
fact = [0] * MAX
invfact = [0] * MAX
fact[0] = 1
for i in range(1, MAX):
    fact[i] = fact[i - 1] * i % MOD
invfact[MAX - 1] = pow(fact[MAX - 1], MOD-2, MOD)
for i in range(MAX - 2, -1, -1):
    invfact[i] = invfact[i+1] * (i+1) % MOD

def nCk(n, k):
    if k < 0 or n < k: return 0
    return (fact[n] * invfact[k] % MOD) * invfact[n-k] % MOD

def nPk(n, k):
    if k < 0 or n < k: return 0
    return fact[n] * invfact[n-k] % MOD



allcnt = pow(10,N,MOD)
notcnt = pow(8,N,MOD)
for i in range(1,N+1):
    notcnt += pow(8,N-i,MOD) * invfact[i] * invfact[N-i] * fact[N] * 2
    notcnt %= MOD

print(allcnt - notcnt)

Submission status: Wrong Answer

Solution code:
def comb(a, b, mod):
    c = 1
    for i in range(a, a - b, -1):
        c = c * (i % mod) % mod

    d = 1
    for i in range(1, b + 1):
        d = d * (i % mod) % mod
        
    return((c // d)% mod)


N = int(input())

mod = 10 ** 9 + 7
r = 8

list_ans = []
for n0 in range(1, N):
    for n9 in range(1, N - n0 + 1):
        n_nokori = N - n0 - n9
        comb_0 = comb(N, n0, mod)
        comb_9 = comb(N - 1, n9, mod)
        
        tmp = 1
        for i in range(n_nokori):
            tmp = (tmp * r) % mod
        
        ans = ((comb_0 % mod) * (comb_9 % mod) * tmp) % mod
        list_ans.append(ans)
        
#         print(f'n0, n9: {n0}, {n9}')
#         print(f'comb_0, comb_9: {comb_0}, {comb_9}')
#         print(ans)
#         print()
        
ans2 = 0
for ans in list_ans:
    ans2 = (ans2 + ans) % mod

print(ans2)

Submission status: Wrong Answer

Solution code:
import math
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

N = int(input())

answer = 0
rest = 10 ** 9 + 7
  
if N == 1:
  answer = 0
else:
  answer = cmb(N, 2) * 2 * (10 ** (N - 2))
print(answer % rest)

Submission status: Wrong Answer

Solution code:

N = int(input())
if N <=1:
    print(0)
else:
    c = 0
    l = [1]*(N+1)
    for i in range(N):
        l[i+1] = l[i]*(i+1)
    for i in range(1,N):
        d = l[N]//l[N-i]
        c +=  (8**(N-i))*d
    a = 10**N - ((8**N) +2*c+2)
    b = a % (10**9 +7)
    print(b)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if (n == 1)or(n==0):
    print(0)
else:
    xn = n-2
    a10 = 2*10**xn

    if n != 2:
        a9 = (9**(n-2)*(n-1)*2)
    else:
        a9 = 0

    ans = (a10+a9)%((10**9)+7)
    print(ans)

Submission status: Wrong Answer

Solution code:
M = 10**9+7
def p(n, r):
    x = 1
    for i in range(r):
        x *= n - i
        x %= M
    return x

N = int(input())

tmp = p(N,2)

tmp2 = (10**(N-2)) %M
#print(tmp)
tmp3 = (2**(N-2)) %M

if N==1:
    print(0)
elif N==2:
    print(2)
else:
    a = tmp*tmp2
    b = tmp*tmp3//2
    print((a%M-b%M)%M)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal
import math
N = int(input())

count = 0




for i in range(1,N):
    for j in range(1,N+1-i):
        if i+j > 1:
            x = (Decimal(math.factorial(i+j)))/(Decimal(math.factorial(i))*(Decimal(math.factorial(j)))) * (8**(N-i-j))
            count += x

    

count = int(count % (10**9 + 7))

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
for i in range(10**N):
  l = str(i)
  count += "0" in l and "9" in l
print(count+(9**(N-2)))

Submission status: Wrong Answer

Solution code:
N = int(input())

print(((N*(N-1))*(10**(N-2)))%1000000007)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())


if n == 1:
    print(0)
    
else:
    print(10**(n-2)*(math.factorial(n))%(10**9+7))

Submission status: Wrong Answer

Solution code:
# -*- using:utf-8 -*-

def factorial_cor(n):
  fact = 1
  for integer in range(1, n + 1):
    fact *= integer
  return fact

if __name__ == "__main__":
  MOD = 1000000007
  N = int(input())
  if N == 1:
    print(0) 
  else:
    C = factorial_cor(N)
    ans = C * 10**(N-2) % MOD
    print(int(ans))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=10**9+7
if N==1:
    z=0
elif N==2:
    z=2
else:
    z=((10**(N-2) *N*2) - (10**(N-3) * (N*2-1))) %S
print(z)

Submission status: Wrong Answer

Solution code:
n = int(input())
rest = n - 2
MOD = 10 ** 9 + 7
# tmp = 10 ** rest
tmp = 1
for _ in range(rest):
    tmp *= 10
    tmp %= MOD
ans = n * (n-1)  % MOD * tmp % MOD
ans %= MOD
print(int(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=0
for i in range(n-1):
    p=10**i*9**(n-i-2)
    s+=p%1000000007
print(int(2*s))

Submission status: Wrong Answer

Solution code:

N = int(input())


num, num2,num3 = 1, 1, 1

for _ in range(N):
    num = num * 10 % 1000000007
    num2 = num2 * 9 % 1000000007
    num3 = num3 * 8 % 1000000007
print(num - num2 * 2 + num3 % 1000000007)