#include #define rep(i, n) for(long long i = 0; i < n; i++) #define ALL(v) (v).begin(), (v).end() using namespace std; using lint = long long; int main() { int n; cin >> n; int ok = 0, ng = 0; while (n--) { int t; string s; cin >> t >> s; int can = 12 * t / 1000; can = min(can, (int)s.size()); ok += can; ng += (int)s.size() - can; } cout << ok << " " << ng << endl; }