#include <bits/stdc++.h>
int main() {
  int num;
  std::cin >> num;
  std::string *a = new std::string[num];
  for (int i = 0; i < num; i++) {
    std::cin >> a[i];
  }
  double kakuritu = 1.0 / (num - 1);
  std::cout << "kakurutu = " << kakuritu << std::endl;
  double kitaiti_sum = 0;
  for (int i = 1; i < num; i++) {
    kitaiti_sum += atoi(a[i].c_str()) * kakuritu;
  }
  std::cout << "kitaiti_sum = " << kitaiti_sum << std::endl;
  int kaizyo = 1;
  for (int i = num - 1; i > 0; i--) {
    kaizyo *= i;
    std::cout << "kaizyo = " << kaizyo << std::endl;
  }
  long int temp = kaizyo * kitaiti_sum;
  std::cout << "temp = " << temp << std::endl;
  int ans;
  ans = temp % 10000007;
  std::cout << "ans = " << ans << std::endl;
  return 0;
}
