#include using namespace std; #define ll long long const int mod=1e9+7; ll K(ll x,ll y=mod-2){ ll t=1; for (;y;y>>=1,x=x*x%mod) if (y&1) t=t*x%mod; return t; } int T, n; int main(){ for (cin>>T;T--;){ int n, ans, p; cin>>n; cin>>p; --n; ans=p/2; for (;n--;){ int x; cin>>x; ll t=(1-(K(2)+K(x)*(p/2))%mod+mod)*(x/2)%mod; ans=(ans+t)%mod; p=x; } cout<