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