module no1801_1850.no1816; 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 : (x + y - 1) / y); ++cnt; } heap.front.writeln; }