#include using namespace std; int main(){ int n; cin >> n; int word=0; int type=0; int t; string s; for(int i=0;i> t >> s; word+=s.size(); if(s.size()>=12*t/1000)type+=12*t/1000; else type+=s.size(); } cout << type << " " << word-type<< endl; return 0; }