#include #include #include #include #include #include #include #define MOD 1000000007 #define llint long long int int main(){ int n; scanf("%d",&n); int *m = malloc(sizeof(int) * n); for(int m_i = 0; m_i < n; m_i++){ scanf("%d",&m[m_i]); } // if sorted llint *nb_ways = malloc(sizeof(llint) * (n+1)); llint *facto_mod = malloc(sizeof(llint) * (n+1)); facto_mod[0] = 1; for(llint i = 1; i <= n; i++) { facto_mod[i] = (facto_mod[i-1]*i)%MOD; } nb_ways[0] = 0; nb_ways[1] = 1; for(llint i = 2 ; i <=n ; i++) { int sum = i; for(llint j = 1; j <= i; j++) { sum += (i*nb_ways[i])%MOD; sum = sum%MOD; } nb_ways[i] = sum+1; } printf("%lld", nb_ways[n]); return 0; }