#include #define rep(i,n)for(long long i=0;i<(n);i++) using namespace std; typedef unsigned long long ull; typedef long long ll; const ll INF=1e18; const int MOD=1e9+7; const double pi=acos(-1); int main(){ int n; cin >> n; ll sum1=0,sum2=0; rep(i,n){ int t; string s; cin >> t >> s; if(12*t/1000>=s.size())sum1+=s.size(); else{ sum1+=12*t/1000; sum2+=s.size()-12*t/1000; } } cout << sum1 << " " <