Problem:
Score : 300 points

Problem Statement

How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions?

0 \leq A_i \leq 9

There exists some i such that A_i=0 holds.

There exists some i such that A_i=9 holds.

The answer can be very large, so output it modulo 10^9 + 7.

Constraints

1 \leq N \leq 10^6

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer modulo 10^9 + 7.

Sample Input 1

2

Sample Output 1

2

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

Sample Input 2

1

Sample Output 2

0

Sample Input 3

869121

Sample Output 3

2511445

Solution in C# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramC a = new ProgramC();
            a.main();//実行する

        }

    }
    //ABC178
    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();
            //30以上ならYes、それ以外はNoを出力
            if(s == "0")
                Console.WriteLine(1);
            else
                Console.WriteLine(0);


        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力

            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]);
            long b = long.Parse(s[1]);
            long c = long.Parse(s[2]);
            long d = long.Parse(s[3]);
            long max1 = Math.Max(a * c, a * d);
            long max2 = Math.Max(b * c, b * d);

            Console.WriteLine(Math.Max(max1, max2));

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            long n = long.Parse(Console.ReadLine());
            long MOD = 1000000000 + 7;

            long ans = modpow(10, n, MOD) - 2 * modpow(9, n, MOD) + modpow(8, n, MOD);
            if (ans < 0)
                ans = MOD - ans;

            Console.WriteLine(ans);


        }

        static long modpow(long a, long n, long MOD)
        {
            if (n == 0)
                return 1;
            if (n % 2 == 0)
            {
                long temp = modpow(a, n / 2, MOD);
                return temp * temp % MOD;
            }

            return a * modpow(a, n - 1, MOD) % MOD;
        }
    }

    class ProgramD
    {
        public void main()
        {
            string[] a = Console.ReadLine().Split(' ');
            long r = long.Parse(a[0]);
            long c = long.Parse(a[1]);
            string[] b = Console.ReadLine().Split(' ');
            long sx = long.Parse(b[0]);
            long sy = long.Parse(b[1]);
            string[] e = Console.ReadLine().Split(' ');
            long gx = long.Parse(e[0]);
            long gy = long.Parse(e[1]);

            long[,] maze = new long[r, c];
            long[,] w = new long[r, c];

            //迷路作成
            for (long i = 0; i < r; i++)
            {
                string d = Console.ReadLine();
                for (int j = 0; j < c; j++)
                {
                    if (d[j] == '#')
                        maze[i, j] = 1;
                    else
                        maze[i, j] = 0;

                }

            }

            for (int i = 0; i < r; i++)
                for (int j = 0; j < c; j++)
                    w[i, j] = 1000000000;

            //キューを用意
            Queue<long> qx = new Queue<long>();
            Queue<long> qy = new Queue<long>();
            Queue<long> ww = new Queue<long>();
            List<long> ans = new List<long>();

            //スタートを入れる
            qx.Enqueue(sx - 1);
            qy.Enqueue(sy - 1);

            ww.Enqueue(0);
            maze[sx - 1, sy - 1] = -1;
            w[sx - 1, sy - 1] = 0;

            while (qx.Count != 0)
            {
                long num = qx.Count;
                for (long i = 0; i < num; i++)
                {
                    long tx = qx.Dequeue();
                    long ty = qy.Dequeue();
                    long wnum = ww.Dequeue();

                    if (tx == gx - 1 && ty == gy - 1)
                        continue;

                    if (w[tx, ty] < wnum)
                        continue;

                    for (long x = -2; x <= 2; x++)
                        for (long y = -2; y <= 2; y++)
                        {
                            long karix = tx - x;
                            long kariy = ty - y;

                            if (x == 0 && y == 0)
                                continue;

                            if (0 <= karix && karix < r && 0 <= kariy && kariy < c)
                            {

                                if (maze[karix, kariy] == 0)
                                {
                                    if (Math.Abs(x) + Math.Abs(y) == 1)
                                    {
                                        if (wnum < w[karix, kariy])
                                        {
                                            qx.Enqueue(karix);
                                            qy.Enqueue(kariy);
                                            ww.Enqueue(wnum);
                                            w[karix, kariy] = wnum;
                                        }
                                    }
                                    else
                                    {
                                        if (wnum + 1 < w[karix, kariy])
                                        {
                                            qx.Enqueue(karix);
                                            qy.Enqueue(kariy);
                                            ww.Enqueue(wnum + 1);
                                            w[karix, kariy] = wnum + 1;
                                        }

                                    }

                                }
                            }
                        }

                }

            }

            if(w[gx -1,gy-1] == 1000000000)
                Console.WriteLine(-1);
            else
                Console.WriteLine(w[gx - 1, gy - 1]);
        }
    }

    class ProgramE
    {

        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            long h = long.Parse(s[0]);
            long w = long.Parse(s[1]);
            long m = long.Parse(s[2]);

            long[] a = new long[m];
            long[] b = new long[m];
            long[] ac = new long[h];
            long[] bc = new long[w];
            for (int i = 0; i < m; i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                a[i] = long.Parse(t[0]);
                b[i] = long.Parse(t[1]);
                ac[a[i] - 1]++;
                bc[b[i] - 1]++;
            }

            long posh = 0;
            long posw = 0;

            long ansh = 0;
            long answ = 0;
            for (int i = 0; i < h; i++)
            {
                if (ansh < ac[i])
                {
                    ansh = ac[i];
                    posh = i + 1;
                }
            }

            for(int i = 0; i < w;i++)
            { 
                if (answ < bc[i])
                {
                    answ = bc[i];
                    posw = i + 1;
                }
            }

            long ans = ansh + answ;

            for (int i = 0; i < m; i++)
            {
                if (a[i] == posh && b[i] == posw)
                {
                    ans--;
                    break;
                }

            }

            Console.WriteLine(ans);
        }


    }

}