#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); int N; cin >> N; int all = 0, ok = 0; rep(i, 0, N) { int T; string S; cin >> T >> S; all += S.size(); ok += min(12 * T / 1000, (int)S.size()); } cout << ok << ' ' << all - ok << '\n'; }