#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) using namespace std; int main() { int n, t, a = 0, b = 0; string s; cin >> n; REP(i, n) { cin >> t >> s; int ssz = s.size(); a += min(ssz, (12 * t / 1000)); b += max(0, ssz - (12 * t / 1000)); } cout << a << " " << b << endl; return 0; }