#include <bits/stdc++.h>
using namespace std;
long long N;
long long x[12] = {0};
long long l[12] = {0};
const long long MOD = 1000000007;
long long facctorialMethod(long long k);
long long facctorialMethod(long long k) {
  long long sum = 1;
  for (long long i = 1; i <= k; ++i) {
    sum *= i;
  }
  return sum;
}
int main() {
  cin >> N;
  for (long long i = 0; i < N; i++) {
    cin >> x[i];
  }
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i; j < N - 1; j++) {
      l[i] += x[j + 1] - x[j];
    }
    long long tmp = 0;
    for (long long j = 0; j < i - 1; j++) {
      tmp += x[j + 1] - x[j];
    }
    if (i != 0) {
      l[i] += x[N - 1] - x[i - 1] + tmp;
    }
  }
  long long sum;
  for (long long i = 0; i < N - 1; i++) {
    sum += l[i];
    cout << l[i] << " ";
  }
  cout << endl;
  cout << sum << endl;
  long long ans = sum % MOD;
  for (long long i = 1; i <= N - 2; ++i) {
    ans *= i;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
