import std; void main() { int N; readf("%d\n", N); auto A = readln.chomp.split.to!(long[]); auto heap = A.heapify; int cnt; while (heap.length > 1) { long x = heap.front; heap.popFront; long y = heap.front; heap.popFront; heap.insert(cnt % 2 == 0 ? x * y : (y + x - 1) / x); ++cnt; } heap.front.writeln; }