puts ARGF.sum { line = _1.chars.map &:to_i; first = line[..-3].max; first * 10 + line[line.find_index(first).succ..].max }
