import heapq def main(): import sys input = sys.stdin.read data = input().split() N = int(data[0]) A = list(map(int, data[1:N+1])) if N == 1: print(A[0]) return if N == 2: print(A[0] * A[1]) return if 1 in A: product = 1 for num in A: product *= num print(product) return B = (N - 1) // 2 min_heap = A.copy() max_heap = [-x for x in A] heapq.heapify(min_heap) heapq.heapify(max_heap) product = 1 for num in A: product *= num for _ in range(B): a = heapq.heappop(min_heap) b = -heapq.heappop(max_heap) c = (b + a - 1) // a product = product // (a * b) * c heapq.heappush(min_heap, c) heapq.heappush(max_heap, -c) print(product) if __name__ == "__main__": main()