How many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions?

* The n-th and subsequent elements are all equal. That is, if n \leq i,j, a_i = a_j.
* For every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\leq i+a_i, a_j = a_k.



Find the count modulo 10^9+7.

Constraints

* 1 \leq n \leq 10^6

Input

Input is given from Standard Input in the following format:


n


Output

Print how many sequences satisfy the conditions, modulo 10^9+7.

Examples

Input

2


Output

4


Input

654321


Output

968545283
#include<bits/stdc++.h>
#define LL long long
#define R register int
using namespace std;
const int YL=1e9+7;
inline void M(R&x){if(x>=YL)x-=YL;}
int main(){
    R n;cin>>n;
    R f2=0,f1=n,f=(LL)n*n%YL,t=(LL)(n-1)*(n-1)%YL,s=0;
    for(R i=n-2;i>0;--i)
        M(s+=f2),f2=f1,f1=f,M(f+=t),M(f+=s+i+1);
    return cout<<f<<endl,0;
}