#include #include const int MAX=1005; int a[MAX]; int main() { int t,n,sum; long long ans; scanf("%d",&t); while(t--) { scanf("%d",&n); memset(a,0,sizeof(a)); for(int i=0;i