import java.io.*; import java.util.*; class Main35 { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ans1 = 0; int ans2 = 0; int n = Integer.parseInt(br.readLine()); for (int i = 0; i < n; i++) { String[] line = br.readLine().split(" "); int t = Integer.parseInt(line[0]); int typeStr = 12 * t / 1000; int len = line[1].length(); ans1 += Math.min(typeStr , len); ans2 += len > typeStr ? len - typeStr : 0; } out(ans1 + " " + ans2); } }