#include <cstdio>
using namespace std;

int main()
{
	int n;
	double ans = 0;

	scanf("%d", &n);
	for (int i = 1; i < n; i++)
		ans += double(n) / (n - i);
	
	printf("%.9lf\n", ans);

	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
int tt,f[100100],n,p=1e9+7;

void prepare(){
	f[0]=1;
	f[1]=1;
	f[2]=2;
	for(int i=3;i<=n;i++)f[i]=(f[i-1]+f[i-2])%p;
}
void solve(){
	cin>>n;
	prepare();
	int a[n],ans=0;
	for(int i=0;i<n;i++){cin>>a[i];}
	ans+=(a[0]*f[n])%p;
	for(int i=1;i<n;i++){
		ans=ans+((f[i]*f[n-i]-f[i-1]*f[n-i-1])%p+p)*a[i];
		ans%=p;
	}
	cout<<ans<<'\n';
}

signed main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //prepare();
    //cin>>tt;
    //while(tt--)
    solve();
}