#include using namespace std; using ll = long long; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> N; ll type = 0; ll miss = 0; FOR(i, 0, N){ ll T; string S; cin >> T >> S; ll L = S.size(); ll can_type = (12*T)/1000; if(can_type>=L){ type += L; }else{ type += can_type; miss += L-can_type; } } p2(type, miss); return 0; }