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