#include #include #include #include using namespace std; #define M 100009 #define INF 1e18-1 int main() { int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); long long ans = 1; long long maxx = -INF; bool ok = false; int cnt = 0,cntf = 0; for(int i = 0;i < n;i++) { long long a; scanf("%lld", &a); if (!a) cnt++; if(a != 0) { ans *= a; ok = true; } if(a < 0) {maxx = max(a,maxx);cntf++;} } if (cnt + cntf == n && cntf == 1) { if (cnt) cout << 0 << endl; else { cout << maxx << endl; } continue; } if(ans < 0) ans /= maxx; if(ok) cout << ans << endl; else cout << 0 << endl; } return 0; }