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