#include <stdio.h>
int main(void)
{
int n; //n项操作
double HP = 10; //总生命值,初始化为10,上限是10
int LV = 0; //等级,初始化为1
int EXP = 0; //总经验值,初始化为0
double de_HP; //减少的生命值
int in_EXP; //增加的经验值
int EXP_per_LV = 1; //每次升级所需要的经验值
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%lf %d", &de_HP, &in_EXP);
//若死亡,跳出循环
if (HP - de_HP <= 0)
{
break;
}
HP -= de_HP;
EXP += in_EXP;
//上限是10
if (HP > 10)
{
HP = 10;
}
}
while (EXP >= EXP_per_LV)
{
EXP -= EXP_per_LV;
LV++;
EXP_per_LV *= 2;
}
printf("%d %d\n", LV, EXP);
return 0;
}