1. #include<stdio.h>
  2. #include<stdbool.h>
  3. #include<malloc.h>
  4. #include <stdio.h>
  5. #include <math.h>
  6. #define MOD 1000000007
  7. int main() {
  8. int tst;
  9. scanf("%d", &tst);
  10. while (tst--) {
  11. int N, i;
  12. scanf("%d", &N);
  13. unsigned long long ans=0;
  14. unsigned long long val = pow(2,N-1);
  15. for (i=0; i<N; i++) {
  16. unsigned long long input;
  17. scanf("%llu", &input);
  18. if (N<64 && input >= val) {
  19. ans = (ans+(input%MOD))%MOD;
  20. }
  21. }
  22. printf("%llu\n", ans);
  23. }
  24. }
Language: C