import strutils, sequtils, math proc main() = var nm = stdin.readLine.split.map(parseInt) (n, m) = (nm[0], nm[1]) abi = (0.. aacc.max: ans += bestAcc.max m -= 1 ans += aacc.max * m echo ans main()