#include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision using namespace std; int main() { int N; cin >> N; int ans_t = 0; int ans_f = 0; for (int i = 0; i < N; i++) { int T; string S; cin >> T >> S; unsigned int temp = 12 * T / 1000; if (S.length() <= temp) { ans_t += S.length(); } else { ans_t += temp; ans_f += S.length() - temp; } } cout << ans_t << " " << ans_f << endl; return 0; }