import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques,heapqueue template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve():int= var n = scan() c = scan() p = newseqwith(n,scan()) #tx = newseqwith(c,(scan(),scan())) type1 = initHeapQueue[int]() # 引く type2 = initHeapQueue[int]() # %引き for i in 0..0 and type2.len>0: if max(0,v+type1[0]) < (v*(100+type2[0])).div(100): result+=max(0,v+type1[0]) discard type1.pop else: result+=(v*(100+type2[0])).div(100) discard type2.pop elif type1.len>0: result+=max(0,v+type1[0]) discard type1.pop elif type2.len>0: result+=(v*(100+type2[0])).div(100) discard type2.pop else: result+=v echo solve()