#include #include using namespace std; int main(int argc, const char* argv[]) { int N; cin >> N; int ttype = 0; int ftype = 0; for (int i = 0; i < N; i++) { int T; string S; cin >> T >> S; int tmp = min((12 * T / 1000), (int)S.size()); ttype += tmp; ftype += S.size() - tmp; } cout << ttype << " " << ftype << endl; return 0; }