- #include<stdio.h>
- #include<stdbool.h>
- #include<malloc.h>
- #include <stdio.h>
- #include <math.h>
- #define MOD 1000000007
- int main() {
- int tst;
- scanf("%d", &tst);
- while (tst--) {
- int N, i;
- scanf("%d", &N);
- unsigned long long ans=0;
- unsigned long long val = pow(2,N-1);
- for (i=0; i<N; i++) {
- unsigned long long input;
- scanf("%llu", &input);
- if (N<64 && input >= val) {
- ans = (ans+(input%MOD))%MOD;
- }
- }
- printf("%llu\n", ans);
- }
- }