#include #include #include using namespace std; int main() { int N, T; string S; cin >> N; int ok = 0; int ng = 0; int t, s; for( int i = 0; i < N; i++ ) { cin >> T >> S; t = ( T * 12 ) / 1000; s = S.size(); ok += min( t, s) ; ng += max( s - t, 0 ); } cout << ok << " " << ng << endl; return 0; }