#include using namespace std; int main() { int N; cin >> N; int ans = 0, cnt = 0; for (int i = 0; i < N; ++i) { int t; cin >> t; int M = 12 * t / 1000; string s; cin >> s; int type = min(M, (int)s.size()); ans += type; cnt += s.size()-type; } cout << ans << " " << cnt << endl; }