#include <bits/stdc++.h>
using namespace std;
int n, r, a[50009];
int dp[50009], dp1[50009], f[2][50009];
void DP(int L, int R, bool inv) {
  for (int i = 0; i <= 2 * r; i++) f[0][i] = f[1][i] = dp[i] = 0;
  f[0][r] = 1;
  int cur = 1;
  for (int i = L; i <= R; i++) {
    int j;
    if (inv)
      j = (L + R) - i;
    else
      j = i;
    for (int k = 0; k <= 2 * r; k++) f[cur][k] = 0;
    for (int k = 0; k <= 2 * r; k++) {
      if (k - a[j] >= 0)
        f[cur][k - a[j]] = (f[cur][k - a[j]] + f[cur ^ 1][k]) % 1000000007;
      if (k + a[j] <= 2 * r)
        f[cur][k + a[j]] = (f[cur][k + a[j]] + f[cur ^ 1][k]) % 1000000007;
    }
    for (int k = 0; k <= 2 * r; k++) dp[k] = (dp[k] + f[cur][k]) % 1000000007;
    cur ^= 1;
  }
}
int solve(int L, int R) {
  int res = 0;
  if (L >= R) return 0;
  r = 0;
  for (int i = L; i <= R; i++) r += a[i];
  int M = (L + R) >> 1;
  DP(L, M, 1);
  for (int i = -r; i <= r; i++) dp1[r + i] = dp[r + i];
  DP(M + 1, R, 0);
  for (int i = -r; i <= r; i++) {
    res = (res + (long long)dp1[i + r] * dp[-i + r] % 1000000007) % 1000000007;
  }
  res += solve(L, M);
  res %= 1000000007;
  res += solve(M + 1, R);
  res %= 1000000007;
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  printf("%d\n", solve(1, n));
  return 0;
}
