#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair pii; typedef vector vll; typedef vector vi; typedef vector> vvi; typedef vector> vvll; const ll inf = 1e16; const ll md = 1000000007; int main() { int n; int did=0,miss=0; rep(i,n){ int t; string s; cin>>t>>s; int mx=12*t/1000; int sz=s.size(); did+=min(mx,sz); miss+=max(sz-mx,0); } cout<