#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin >> n; int ans=0,sum=0; rep(i,n){ int t;cin >> t; string s;cin >> s; int k=s.size(); sum+=min(k,(12*t)/1000); ans+=max(0,k-min(k,(12*t)/1000)); } cout << sum << " " << ans << endl; }