#include using namespace std; int main() { int q; cin >> q; int ok = 0, ng = 0; while (q--) { int t; string s; cin >> t >> s; const int n = s.length(); const int res = (12 * t) / 1000; ok += min(n, res); ng += max(0, n - res); } cout << ok << ' ' << ng << '\n'; return 0; }