import java.util.*; public class Main { public static Scanner sc = new Scanner(System.in); public static int n; public static int[] a; public static int[] b; public static long ret = Long.MIN_VALUE; public static void main(String[] args) throws Exception { n = sc.nextInt(); a = new int[n]; b = new int[n]; for (int i = 0;i < n;i++) a[i] = sc.nextInt(); calc(0, a[0]); System.out.println(ret); } public static void calc(int c, long val) { if (c==n-1) { ret = Math.max(ret,val); return; } int t = val>=0?3:4; for (int i = 0;i < t;i++) { if (i==0) calc(c+1,val+a[c+1]); if (i==1) calc(c+1,val-a[c+1]); if (i==2) calc(c+1,val*a[c+1]); if (i==3) calc(c+1,val/a[c+1]); } } }