#include <bits/stdc++.h>
using namespace std;
int n,m,t,st,f = 1;
float sx,x = 10;
int main(){
cin>>n;
for(int i = 1;i <= n;i ++){
cin>>sx>>st;
x = x - sx;
if(x <= 0){
break;
}
t = t + st;
}
for(int i = 1;t > 0;i ++){
m ++;
t = t - f;
f = f << 1;
}
cout<<m<<" "<<t;
}
结果