#include <bits/stdc++.h>
#ifndef _LIB_MODULAR_INTEGER
#define _LIB_MODULAR_INTEGER
#include <bits/stdc++.h>
#ifndef _LIB_NUMBER_THEORY
#define _LIB_NUMBER_THEORY
#include <bits/stdc++.h>

namespace lib {
  using namespace std;
namespace nt {
  int64_t inverse(int64_t a, int64_t b) {
    long long b0 = b, t, q;
    long long x0 = 0, x1 = 1;
    if (b == 1) return 1;
    while (a > 1) {
      q = a / b;
      t = b, b = a % b, a = t;
      t = x0, x0 = x1 - q * x0, x1 = t;
    }
    if (x1 < 0) x1 += b0;
    return x1;
  }
}
}  // namespace lib

#endif

#if __cplusplus < 201300
#error required(c++14)
#endif

namespace lib {
  using namespace std;
namespace {
  template<typename T, T ...Mods>
  struct ModularIntegerBase {
    typedef ModularIntegerBase<T, Mods...> type;

    T x[sizeof...(Mods)];
    friend ostream& operator<<(ostream& output, const type& var) {
      output << "(";
      for(int i = 0; i < sizeof...(Mods); i++) {
        if(i) output << ", ";
        output << var.x[i];
      }
      return output << ")";
    }
  };

  template<typename T, T Mod>
  struct ModularIntegerBase<T, Mod> {
    typedef ModularIntegerBase<T, Mod> type;

    T x[1];

    explicit operator int() const { return this->x[0]; }
    explicit operator long long() const { return this->x[0]; }
    explicit operator double() const { return this->x[0]; }
    explicit operator long double() const { return this->x[0]; }
    friend ostream& operator<<(ostream& output, const type& var) {
      return output << var.x[0];
    }
  };


  template<typename T, class Enable, T ...Mods>
  struct ModularIntegerImpl : ModularIntegerBase<T, Mods...> {
    typedef ModularIntegerImpl<T, Enable, Mods...> type;
    typedef T type_int;
    typedef int64_t large_int;
    const static size_t n_mods = sizeof...(Mods);

    struct Less {
      bool operator()(const type& lhs, const type& rhs) const {
        for(size_t i = 0; i < sizeof...(Mods); i++)
          if(lhs.x[i] != rhs.x[i])
            return lhs.x[i] < rhs.x[i];
        return false;
      };
    };
    typedef Less less;

    constexpr static T mods[sizeof...(Mods)] = {Mods...};
    using ModularIntegerBase<T, Mods...>::x;

    ModularIntegerImpl() {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] = T();
    }
    ModularIntegerImpl(large_int y) {
      for(size_t i = 0; i < sizeof...(Mods); i++) {
        x[i] = y % mods[i];
        if(x[i] < 0) x[i] += mods[i];
      }
    }
    static type with_remainders(T y[sizeof...(Mods)]) {
      type res;
      for(size_t i = 0; i < sizeof...(Mods); i++)
        res.x[i] = y[i];
      res.normalize();
      return res;
    }

    void normalize() {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        if((x[i] %= mods[i]) < 0)
          x[i] += mods[i];
    }

    inline T operator[](int i) const { return x[i]; }

    inline T multiply(T a, T b, T mod) const {
      return (large_int)a*b % mod;
    }

    inline T inv(T a, T mod) const {
      return static_cast<T>(nt::inverse(a, mod));
    }

    type inverse() const {
      T res[sizeof...(Mods)];
      for(size_t i = 0; i < sizeof...(Mods); i++)
        res[i] = inv(x[i], mods[i]);
      return type::with_remainders(res);
    }
    
    template<typename U>
    T power_(T a, U p, T mod) {
      if(mod == 1) return T();
      if(p < 0) {
        if(a == 0)
          throw domain_error("0^p with negative p is invalid");
        p = -p;
        a = inv(a, mod);
      }
      if(p == 0) return T(1);
      if(p == 1) return a;
      T res = 1;
      while(p > 0) {
        if(p&1)
          res = multiply(res, a, mod);
        p >>= 1;
        a = multiply(a, a, mod);
      }
      return res;
    }
 
    type& operator+=(const type& rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        (x[i] += rhs.x[i]) %= mods[i];
      return *this;
    }
    type& operator-=(const type& rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        if((x[i] -= rhs.x[i]) < 0)
          x[i] += mods[i];
      return *this;
    }
    type& operator*=(const type& rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] = multiply(x[i], rhs.x[i], mods[i]);
      return *this;
    }
    type& operator/=(const type& rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] = multiply(x[i], inv(rhs.x[i], mods[i]), mods[i]);
      return *this;
    }

    type& operator+=(T rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] += rhs;
      normalize();
      return *this;
    }
    
    type& operator-=(T rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] -= rhs;
      normalize();
      return *this;
    }

    type& operator*=(T rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] = multiply(x[i], rhs, mods[i]);
      return *this;
    }

    type& operator/=(T rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] = multiply(inv(rhs, mods[i]), x[i], mods[i]);
      return *this;
    }

    type& operator^=(large_int p) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        x[i] = power_(x[i], p, mods[i]);
      return *this;
    }

    type& operator++() {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        if((++x[i]) >= mods[i])
          x[i] -= mods[i];
      return *this;
    }
    type& operator--() {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        if((--x[i]) < 0)
          x[i] += mods[i];
      return *this;
    }
    type& operator++(int unused) { type res = *this; ++(*this); return res; }
    type& operator--(int unused) { type res = *this; --(*this); return res; }

    friend type operator+(const type& lhs, const type& rhs) {
      type res = lhs;
      return res += rhs;
    }
    friend type operator-(const type& lhs, const type& rhs) {
      type res = lhs;
      return res -= rhs;
    }
    friend type operator*(const type& lhs, const type& rhs) {
      type res = lhs;
      return res *= rhs;
    }
    friend type operator/(const type& lhs, const type& rhs) {
      type res = lhs;
      return res /= rhs;
    }

    friend type operator+(const type& lhs, T rhs) {
      type res = lhs;
      return res += rhs;
    }
    
    friend type operator-(const type& lhs, T rhs) {
      type res = lhs;
      return res -= rhs;
    }

    friend type operator*(const type& lhs, T rhs) {
      type res = lhs;
      return res *= rhs;
    }
    
    friend type operator/(const type& lhs, T rhs) {
      type res = lhs;
      return res /= rhs;
    }

    friend type operator^(const type& lhs, large_int rhs) {
      type res = lhs;
      return res ^= rhs;
    }

    friend type power(const type& lhs, large_int rhs) {
      return lhs ^ rhs;
    }

    type operator-() const {
      type res = *this;
      for(size_t i = 0; i < sizeof...(Mods); i++)
        if(res.x[i])
          res.x[i] = mods[i] - res.x[i];
      return res;
    }

    friend bool operator==(const type& lhs, const type& rhs) {
      for(size_t i = 0; i < sizeof...(Mods); i++)
        if(lhs.x[i] != rhs.x[i])
          return false;
      return true;
    }
    friend bool operator!=(const type& lhs, const type& rhs) {
      return !(lhs == rhs);
    }
 
    friend istream& operator>>(istream& input, type& var) {
      T y; cin >> y;
      var = y;
      return input;
    }
  };
}

  // Explicitly make constexpr available for linkage.
  template<typename T, class Enable, T ...Mods>
  constexpr T ModularIntegerImpl<T, Enable, Mods...>::mods[];
 
  template<typename T, T ...Mods>
  using ModularInteger = 
    ModularIntegerImpl<T,
                       typename enable_if<is_integral<T>::value>::type,
                       Mods...>;
 
  template<int32_t ...Mods>
  using Mint32 = ModularInteger<int32_t, Mods...>;

  template<int64_t ...Mods>
  using Mint64 = ModularInteger<int64_t, Mods...>;
}  // namespace lib

#endif
#ifndef _LIB_RANDOM
#define _LIB_RANDOM
#include <bits/stdc++.h>

namespace lib {
  using namespace std;
namespace rng {
  struct Generator {
    mt19937 rng;
    Generator() {
      seed_seq seq{(uint64_t) chrono::duration_cast<chrono::nanoseconds>(
          chrono::high_resolution_clock::now().time_since_epoch()).count(),
#if __cplusplus > 201300
               (uint64_t) make_unique<char>().get(),
#else
               (uint64_t) unique_ptr<char>(new char).get(),
#endif
               (uint64_t) __builtin_ia32_rdtsc()};
      rng = mt19937(seq);
    }
    Generator(seed_seq& seq) : rng(seq) {}

    template<typename T,
             typename enable_if<is_integral<T>::value>::type* = nullptr>
    inline T uniform_int(T L, T R) {
      return uniform_int_distribution<T>(L, R)(rng);
    }

    template<typename T>
    inline T uniform_int(T N) {
      return uniform_int(T(), N-1);
    }

    template<typename T>
    inline T uniform_real(T N) {
      return uniform_real(0.0, static_cast<double>(N));
    }

    template<typename T>
    inline T uniform_real(T L, T R) {
      return uniform_real_distribution<double>(static_cast<double>(L),
                                               static_cast<double>(R))(rng);
    }

    inline double uniform_real() {
      return uniform_real(0.0, 1.0);
    }
  };

  static Generator gen = Generator();
}  // namespace rng
static rng::Generator& rng_gen = rng::gen;
}  // namespace lib

#endif
#define int long long
using namespace std;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ms(v, x) memset((v), (x), sizeof(v))
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define iopt ios::sync_with_stdio(false); cin.tie(0)

int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); }
int power(int x, int p, int MOD) {
    if(p == 0) return 1%MOD;
    if(p == 1) return x%MOD;
    int res = power(x, p/2, MOD);
    res = (long long)res*res%MOD;
    if(p&1) res = (long long)res*x%MOD;
    return res;
}

typedef pair<int, int> ii;
typedef long double LD;
typedef vector<int> vi;

const int MOD = (int)1e9+7;
using Field = lib::Mint32<MOD>;

const int N = 2e5+100;
Field fat[N];

void precompute() {
  fat[0] = 1;
  for(int i = 1; i < N; i++) fat[i] = fat[i-1] * i;
}

Field go_interval(int i, int n) {
  return fat[i] * 2 * fat[n] / fat[i + 2];
}

Field solve_middle(const vector<int>& a) {
  if(a.size() <= 2) return 0;
  vector<int> b(a.begin() + 1, a.end() - 1);
  int n = b.size();

  vector<Field> sum(n + 1);
  vector<Field> pref(n + 1);
  vector<Field> suf(n + 1);
  for(int i = 1; i <= n; i++) sum[i] = sum[i-1] + fat[i] / fat[i+2];
  for(int i = 1; i <= n; i++) pref[i] = pref[i-1] + fat[i] / fat[i+2] * i;
  for(int i = 1; i <= n; i++) suf[i] = suf[i-1] + fat[n-i+1] / fat[n-i+3] * i;


  Field res = 0;
  for(int i = 0; i < n; i++) {
    int cnt = min(i + 1, n - i);
    int rem = n - 2 * cnt;
    Field acc = 0;
    acc += pref[cnt];
    acc += suf[cnt];
    acc += (sum[cnt + rem] - sum[cnt]) * Field(cnt);
    res += acc * b[i];
  }

  res *= fat[n + 2] * 2;
  return res;
}

Field solve_naive_middle(const vector<int>& a) {
  if(a.size() <= 2) return 0;
  vector<int> b(a.begin() + 1, a.end() - 1);
  int n = b.size();

  auto get_interval = [&n](int i) { return go_interval(i, n + 2); };

  Field res = 0;
  for(int i = 0; i < n; i++) {
    Field acc = 0;
    for(int j = i; j < n; j++) {
      acc += b[j];
      int sz = j-i+1;
      res += get_interval(sz) * acc;
    }
  }

  return res;
}

Field solve_proper_prefix(const vector<int>& a) {
  int n = a.size();
  Field acc = 0, res = 0;
  for(int i = 1; i < n; i++) {
    acc += a[i-1];
    res += acc * fat[i] * fat[n] / fat[i + 1];
  }

  return res;
}

Field solve_borders(vector<int> a) {
  int n = a.size();
  Field res = solve_proper_prefix(a);
  reverse(all(a));
  res += solve_proper_prefix(a);
  res += Field(accumulate(all(a), 0LL)) * fat[n];
  return res;
}

Field solve_naive(vector<int> a) {
  Field res = solve_borders(a);
  res += solve_naive_middle(a);
  return res;
}

Field solve(vector<int> a) {
  Field res = solve_borders(a);
  res += solve_middle(a);
  return res;
}

void stress(int n, int mx, int mx_its = 1000) {
  vector<int> test(n);
  Field ja, pa;
  int its = 0;
  do {
    for(int i = 0; i < n; i++) test[i] = lib::rng_gen.uniform_int<int>(mx);
    ja = solve_naive(test);
    pa = solve(test);
  } while(ja == pa && its++ < mx_its);

  if(ja != pa) {
    cout << "Expected: " << ja << endl;
    cout << "Found: " << pa << endl;
    cout << test.size() << endl;
    for(int x : test) cout << x << " ";
    cout <<endl;
  } else {
    cout << "Found nothing" << endl;
  }
}

int32_t main(){
  precompute();

  iopt;
  int n;
  cin >> n;

  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];

  //cerr << solve_naive(a) << endl;
  cout << solve(a) << endl;
}


Measured memory_bytes: 4592