#include #include using namespace std; typedef long long ll; int main(){ int n, x; cin >> n; ll a, b; cin >> a; b = a; for(int i = 1; i < n; i++){ cin >> x; ll na = max(max(a, max(a*x, max(a+x, a-x))), max(b, max(b*x, max(b+x, b-x)))); if(x) na = max(na, a/x); ll nb = min(min(a, min(a*x, min(a+x, a-x))), min(b, min(b*x, min(b+x, b-x)))); if(x) nb = min(nb, b/x); a = na, b = nb; } cout << a << endl; return 0; }