#include #include #include #define TLIMIT 1000 #define NLIMIT 1000 #define ALIMIT 1000 int a[NLIMIT]; int main() { int t; scanf("%d", &t); assert(1 <= t && t <= TLIMIT); while(t--) { int n; scanf("%d", &n); assert(1 <= n && n <= NLIMIT); for(int i=0; i= 0; i -= 4) { ans += a[i]; if(i) ans += a[i-1]; } printf("%d\n", ans); } }