#include #define ll long long #define MOD 1000000007 using namespace std; ll dp[2010][2010]; ll a[2010]; ll n; ll fact[2010], inv[2010]; ll power(ll a, ll b, ll mod){ ll ret = 1; while(b){ if(b&1)ret = ret*a % mod; a = a*a % mod; b >>= 1; } return ret; } ll solve(ll idx, ll k){ // cout<>n; fact[0] = 1; inv[0] = 1; for(int i=1; i<=n; i++){ fact[i] = (fact[i-1]*i)%MOD; inv[i] = power(fact[i], MOD-2, MOD); } for(int i=1; i<=n; i++)cin>>a[i]; ll ans = 0; for(int i=1; i<=n; i++){ // cout<