#include <iostream>
#include <string.h>
#include <string>
#include <cmath>
#include<vector>
#include <algorithm>
#include <iterator>
#include <map>  
#include <utility>
#include<numeric>
#include <iomanip>
#include <set>
#define ul unsigned long long int
#define sll signed long long int
#define ll long long int
#define pb push_back
#define db double

using namespace std;
ll meh=1000000000+7;
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}
  
ll levi(ll n , ll k)
{
    if (n%k==0)
    {
        return n/k;
    }
    else
    {
        return (((n-(n%k))/k)+1);
    }
    
}
ll mex(ll a,ll b){
    if (a>=b)
    {
        return a;
    }
    else{
        return b;
    }
    
}
ll men(ll a,ll b){
    if (a<=b)
    {
        return a;
    }
    else{
        return b;
    }
    
}

ll diff(ll a,ll b){
    if (a>=b)
    {
        return a-b;
    }
    else{
        return b-a;
    }
    
}
ll expoi(ll a,ll n){
    if (n==0)
    {
        return 1;
    }
    else{
        return a*expoi(a,n-1);
    }
    
}
ll asb(ll n){
    if (n>=0)
    {
        return n;
    }
    else{
        return -n;
    }
    
}

ll sumdi(ll n){
    if (n<10)
    {
        return n;
    }
    else{
        return n%10+sumdi((n-n%10)/10);
    }
    
}

int main()
{
    ll n;
    cin>>n;
    vector<ll> arr(n+1);
    for (ll i = 0; i < n; i++)
    {
        cin>>arr[i+1];
    }
    if (n==1)
    {
        cout<<arr[1]%meh<<endl;
    }
    else if (n==2)
    {
        cout<<(2*arr[1])%meh<<endl;
    }
    else
    {
        vector<ll> ans(n+1),calc(n+1);
        ans[1]=arr[1]%meh,calc[1]=1,calc[2]=2,ans[2]=(2*arr[1])%meh;
        for (ll i = 2; i <= n; i++)
        {
            calc[i]=(calc[i-1]+calc[i-2])%meh;
        }
        for (ll i = 2; i <= n; i++)
        {
            ans[i]=(ans[i-1]+calc[i-2]*arr[i]+ans[i-2]+arr[i-1]*(calc[i-1]))%(meh);
        }
        ll r=ans[n]%(meh);
        cout<<r<<endl;
    }
    
    
    

    
    
    
    
    
    
    
    


    
    

    return 0;
}
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}
template<class T> bool chmax(T& a, const T& b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T> bool chmin(T& a, const T& b) {
	if (a > b) { a = b; return 1; }
	return 0;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	REP(i, N) {
		int x, y, r;
		cin >> x >> y >> r;
		cout << x << " " << y << " " << x + 1 << " " << y + 1 << endl;
	}
	return 0;
}