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

#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define popb pop_back()
#define lb lower_bound
#define mp make_pair
#define le length()
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
typedef unordered_map<ll,ll> ull;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0,lim-1);
  return uid(rang);
}
int gcd(int a , int b)
{
  if(max(a,b)% min(a,b) == 0)
  {
    return min(a,b);
  }
  return gcd(max(a,b)%min(a,b) , min(a,b));
}
ll p = 1000000007;

void SieveOfEratosthenes(long n) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. a value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (long i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    long long sum = 0;
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          sum+=p;
    cout<<sum%10<<'\n'; 
} 

ll power(ll x, ll  y)  
{  
   
    ll res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
} 
void printit(vi &a)
{
  for(auto it:a)cout<<it<<" ";
    cout<<endl;
}
void rec(vi &a , int i , int n )
{
  if( i >= a.size())
    return;
  for(int j = 0;j<n;j++)
  {
    //cout<<i<<" "<<j<<endl;
    int temp = a[i];
    a[i] = j;
    rec(a, i+1,n);
    a[i] = temp;
  }
  //return;
  for(auto it:a)
    cout<<it<<" ";
  cout<<endl;
}

void fun(int n , int k)
{
  vector<int> v(k, 0);
  //for(int i = 0 ; i <k;i++)
  rec(v,0,n);
  
}
int dfs(vvi g, char start)  
{

  int te = 0;
  vector<bool> visited(2001 , false);
      int s = start;
      stack<int> st;
      st.push(s);
      while(!st.empty())
      {
        int temp = st.top();
        st.pop();
        visited[temp] =true;
        te+=g[temp].size();
        for(int i = 0 ;i <g[temp].size() ;i++)
        {
          if(!visited[g[temp][i]]){
            
            st.push(g[temp][i]);
            visited[g[temp][i]] = true;
          }

        }
       // cout<<temp<<" "<<te<<endl;
      }
    return te;
}
void solve(){
	ll i , n  , m, k ,a,b,c,d;
	cin>>n;
	ll ans = (power(10,n)
		- power(9,n)
		- power(9,n)
		+ power(8,n)
		+p
	 )%p;
	cout<<ans<<'\n';
  
} 

  

 
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    #ifndef ONLINE_JUDGE
          freopen("input.txt", "r", stdin);
          freopen("output.txt", "w", stdout);
    #endif
          int t;
          t = 1;
          //cin>>t;
          int tt = t;
    for(int tt = 0;tt<t;tt++) {
      //cout<<"Test Case"
     solve();   
    }
 	
    return 0;
}
 


/// aavaz aarhi h???