#include <bits/stdc++.h>
constexpr auto Z = 1000000000 + 7;
using namespace std;
int main() {
  long long int n, length = 0;
  cin >> n;
  vector<long long int> x(n);
  for (auto& i : x) {
    cin >> i;
  }
  for (long long int i = 1; i < n; i++) {
    length += x[i];
  }
  length %= Z;
  cout << length << endl;
}
