local function mma(x, y) return x < y and y or x end local function mmi(x, y) return x < y and x or y end local n = io.read("*n") local a = {} for i = 1, n do a[i] = io.read("*n") end local min, max = 0LL + a[1], 0LL + a[1] for i = 2, n do local c = {} c[1] = min + a[i] c[2] = min - a[i] c[3] = min * a[i] if 0 <= min * a[i] then c[4] = min / a[i] else c[4] = -(-min / a[i]) end c[5] = max + a[i] c[6] = max - a[i] c[7] = max * a[i] if 0 <= max * a[i] then c[8] = max / a[i] else c[8] = -(-max / a[i]) end for i = 1, 8 do min = mmi(min, c[i]) max = mma(max, c[i]) end end local str = tostring(max):gsub("LL", "") print(str)