import sequtils,math,strutils proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord proc scanFixed(): tuple[a,b:int64] = var minus = false var now = 0 var isA = true var bcnt = 10_0000_00000 while true: let k = getchar_unlocked() if k == '-' : minus = true elif k == '.': if minus : now *= -1 result.a = now now = 0 isA = false elif k < '0': if minus : now *= -1 if isA : result.a = now else: result.b = now * bcnt return else: now = 10 * now + k.ord - '0'.ord if not isA: bcnt = bcnt div 10 let n = scan() let F = newSeqWith(n,scanFixed()) var aSum = F.mapIt(it.a).sum() var bSum = F.mapIt(it.b).sum() if aSum < 0 xor bSum < 0 : var minus = aSum + bSum div 10_0000_00000 < 0 if minus: aSum *= -1 bSum *= -1 aSum -= 1 bSum += 10_0000_00000 if minus: aSum *= -1 bSum *= -1 # echo aSum # echo bSum # echo F let a = aSum + bSum div 10_0000_00000 let b = bSum mod 10_0000_00000 let B = ($b.abs) & "0".repeat(10 - ($(b.abs)).len) echo a,".",B