#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU N = gets.to_i total = 0 failure = 0 N.times do t, s = gets.chomp.split total += s.size typeable = (12.0 * t.to_f / 1000.0).floor failure += [s.size - typeable, 0].max end puts '%d %d' % [total - failure, failure]