#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; ll s = 0, a = 0; while(N--){ ll t; cin >> t; string x; cin >> x; ll ss = x.size(); s += ss; a += max(ll(0), ss - 12 * t / 1000); } cout << s - a << " " << a << endl; }