#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 200010;
const int MOD = 1e9 + 7;

int n;
ll a[N], fib[N];

inline ll get (int x) {
  return x < 0 ? 1 : fib[x + 2];
}

int main() {
  fib[1] = 1;
  for (int i = 2; i < N; ++i) {
    fib[i] = fib[i - 1] + fib[i - 2];
    if (fib[i] >= MOD) fib[i] -= MOD;
  }
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", a + i);
  }
  ll ans = get(n - 1) * a[1] % MOD;
  for (int i = 2; i <= n; ++i) {
    ll cur = get(i - 2) * get(n - i) % MOD * a[i] % MOD;
    ans += cur;
    cur = get(i - 3) * get(n - i - 1) % MOD * (MOD - a[i]) % MOD;
    ans += cur;
  }
  ans %= MOD;
  cout << ans << '\n';
  return 0;
}



#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;

int main(){
    ll t,n;
    cin >> t >> n;
    ll nos =0; // nowStart
    vector<ll> j; 
    ll jOfSet = 0;
    while(1){
        ll jum = (100-nos + t -1) / t; // jump
        ll nes = (nos + t* jum) % 100; // nextStart
        j.push_back(jum);
        jOfSet += jum;
        if(nes == 0) break;
        nos = nes;
    }
    ll fracJ = 0;
    // rep(i, n%t) fracJ += j[i];
    int lcnt =  n % (int)j.size();
    for(int i=0; i < lcnt; i++) {
        fracJ += j[i];
    }
    ll nA = (ll)jOfSet * (n/(int)j.size()) + fracJ; 
    ll ans = ((100+t)*nA) / 100 -1;
    cout << ans << endl;
}