#include using namespace std; namespace jumpmelon { typedef long long big; const int P = 1000000007, INV_2 = (P + 1) >> 1; const int MAXN = 10; int A[MAXN + 1]; void work() { int kase; scanf("%d", &kase); while (kase--) { int n, ans = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &A[i]); ans += A[1]; for (int i = 2; i <= n; i++) ans += (A[i] - A[i - 1]) / 2; printf("%d\n", int((big)ans * INV_2 % P)); } } } int main() { jumpmelon::work(); return 0; }