//Awwawa! Dis cold yis ratten buy tEMMIE! #include #define ll long long #define maxn 100005 /*rem*/ #define mod 1000000007 #define db double #define vi vector #define pb push_back #define mp make_pair #define pi pair #define fi first #define se second template bool chkmax(T &x,T y){return x bool chkmin(T &x,T y){return x>y?x=y,true:false;} using namespace std; ll ksm(ll a, ll b) { if (!b) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns; } int a[maxn]; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int ans = 0; for (int i = 1; i <= n; i++) cin >> a[i], a[i] /= 2, ans += a[i]; for (int i = 1; i < n; i++) { ll cur = (a[i] + a[i + 1]); if (cur % 2) cur += mod; cur /= 2; ans -= cur; ans %= mod; } if (ans < 0) ans += mod; cout << ans << endl; } return 0; }