#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__);
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
const int INF = 1e18;
const int MX = 1000001;


int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    int n;
    cin>>n;
    int arr[n],pref[n];
    rep(i,0,n)cin>>arr[i];
    pref[0]=arr[n-1];
    for(int i = 1;i<n;i++){
        pref[i]=pref[i-1]+arr[n-1-i];
        // see(pref[i]);
    }
    int sum = 0;
    for(int i = 0;i<n-1;i++){
        sum=((sum%MOD)+((arr[i]%MOD)*(pref[n-2-i]%MOD))%MOD)%MOD;
    }
    cout<<sum<<endl;

    
 
    return 0;
}

#include<iostream>
using namespace std;
long long int MOD = 1000000007;
long long modpow(long long a, long long n, long long mod);
long long modinv(long long a, long long mod);
int main() {

	//D
	long long int h, w, a, b;
	cin >> h >> w >> a >> b;
	long long int sum = 1;
	long long int i, j;
	for (i = 1; i <= h - a - 1 + b; i++) {
		sum = (sum * i) % MOD;
	}
	for (i = 1; i <= w - b - 1 + a - 1; i++) {
		sum = (sum * i) % MOD;
	}
	for (i = 1; i <= h - a - 1; i++) {
		sum = (sum * modinv(i, MOD)) % MOD;
	}
	for (i = 1; i <= b; i++) {
		sum = (sum * modinv(i, MOD)) % MOD;
	}
	for (i = 1; i <=w-b-1; i++) {
		sum = (sum * modinv(i, MOD)) % MOD;
	}
	for (i = 1; i <= a - 1; i++) {
		sum = (sum * modinv(i, MOD)) % MOD;
	}
	//cout << sum << endl;
	long long int sumsum = 0;
	for (i = b; i <= w - 1; i++) {
		sumsum = (sum + sumsum) % MOD;
		//cout << "sumsum" << sumsum;
		sum = (sum * (w - i - 1)) % MOD;
		sum = (sum * (h - a - 1 + i + 1)) % MOD;
		sum = (sum * modinv(w - i - 1 + a - 1, MOD)) % MOD;
		sum = (sum * modinv(i + 1, MOD)) % MOD;
		//cout << sum << endl;
	}
	cout << sumsum << endl;
	return 0;
	//C
	/*int n,k;
	int d[10];
	cin >> n >> k;
	int i;
	for (i = 0; i < k; i++) {
		cin >> d[i];
	}
	int x,j;
	int flag;
	for (i = n; i < 99999; i++) {
		x = i;
		flag = 0;
		while (x > 0) {
			for (j = 0; j < k; j++) {
				if ((x % 10) == d[j]) {
					flag = 1;
					break;
				}
			}
			if (flag == 1)break;
			x = (x - (x % 10)) / 10;
		}
		if (flag == 0) {
			cout << i << endl;
			return 0;
		}
	}*/



}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod) {
	return modpow(a, mod - 2, mod);
}