import scala.math._ object Main { def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val n = sc.nextInt var hit = 0 var miss = 0 for (i <- 0 to n-1) { val t = sc.nextInt val s = sc.next // タイプできる文字数 val x = min(12 * t / 1000, s.length) hit += x miss += max(0, s.length - x) } println(s"$hit $miss") } }