import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No35 { public static void main(String[] args) throws IOException{ BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int inputComp = 0; int inputUncomp = 0; for(int i=0; i < n; i++){ String[] str = br.readLine().split(" "); int t = Integer.parseInt(str[0]); int temp = Math.min((12*t)/1000, str[1].length()); inputUncomp += str[1].length() - temp; inputComp += temp; } System.out.println(inputComp +" "+ inputUncomp); } }