import strutils, sequtils, algorithm, math discard readLine(stdin).parseInt let cSeq = readLine(stdin).split(' ').map(parseInt) border = cSeq.sum div 10 result = 30 * cSeq.map(proc (c: int): int = if c <= border: 1 else: 0 ).sum echo(result)