#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (1 << 30) #define INFLL (1LL << 60) int main() { int n,t,ans = 0,sum = 0; string str; cin >> n; int how = 0; for(int i = 0;i < n;i++){ cin >> t >> str; how = 12 * t / 1000; if(str.size() < how) ans += str.size(); else { ans += how; sum += str.size() - how; } } cout << ans << " " << sum << endl; return 0; }