#include #include using namespace std; int main(int argc, char* argv[]) { int n; cin >> n; int typed = 0; int notTyped = 0; for (int i = 0; i < n; ++i) { int t; string s; cin >> t >> s; int typable = 12 * t / 1000; if (typable >= s.size()) { typed += s.size(); } else { typed += typable; notTyped += s.size() - typable; } } cout << typed << " " << notTyped << endl; return 0; }