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++ (GCC 9.2.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=1000000+9,mod=1e9+7;
ll F[N],IF[N],P2[N];
ll power(ll b,ll p){

  if(p==0) return 1;
  if(p%2==0){
    return power(b*b%mod,p/2);
  }
  else{
    return b*power(b*b%mod,p/2)%mod;
  }
}
ll C(int n,int r){

  return F[n]*IF[n-r]%mod*IF[r]%mod;
}
int main(){
    GO();

    int T;
  //  cin>>T;
    T=1;
    while(T--){
        int n;
        cin>>n;
        if(n==1){
            cout<<"0\n";
            continue;
        }
        F[0]=1;
        P2[0]=1;
        for(int i=1;i<=n;i++) F[i]=(F[i-1]*i)%mod,P2[i]=(P2[i-1]*2)%mod;
        IF[n]=power(F[n],mod-2);

        for(int i=n-1;i>=0;i--){
            IF[i]=(IF[i+1]*(i+1))%mod;
        }
        ll pp=1,ans=0;
        for(int i=0;i<=n-2;i++){

            ll res= C(n,i)*pp%mod*(((P2[n-i]-2)%mod+mod)%mod)%mod;
            ans+=res;
            ans%=mod;
            pp*=8;
            pp%=mod;
        }

        cout<<ans<<"\n";


    }

}