#include #include #include using namespace std; int main() { int n; cin >> n; int c = 0, m = 0; for (int i = 0; i < n; i++) { int t; string str; cin >> t >> str; int max_type = 12 * t / 1000; if (str.length() < max_type) { c += str.length(); } else { c += max_type; m += str.length() - max_type; } } cout << c << " " << m << endl; return 0; }