#include<iostream>
using namespace std;
int main(){
  long n,m,ans[2],a[8];
  cin >> n;
  cin >> m;
  ans[0] = m;
  ans[1] = m;
  for(int i=1;i<n;i++){
    cin >> m;
    for(int j=0;j<2;j++){
      a[4*j] = ans[j]+m;
      a[4*j+1] = ans[j]-m;
      a[4*j+2] = ans[j]*m;
      a[4*j+3] = (m!=0)?ans[j]/m:a[4*j];
    }
    ans[0] = a[0];
    ans[1] = a[1];
    for(int j=1;j<8;j++){
      if(a[j]>ans[0]){
        ans[0] = a[j];
      }
      if(a[j]<ans[1]){
        ans[1] = a[j];
      }
    }
  }
  cout << ans[0] << endl;
}