#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int occupation,level,point=0;
while(cin>>occupation>>level)
{
if(occupation==0)
{
cout<<0<<endl;
}
else
if(level<8)
{
cout<<0<<endl;
}
else
if(level==8)
{
if(occupation==2)
{
cout<<1<<endl;
}
else
cout<<0<<endl;
}
else
if(level==9)
{
if(occupation==2)
{
cout<<4<<endl;
}
else
cout<<0<<endl;
}
else
if(level==10)
{
if(occupation==2)
{
cout<<7<<endl;
}
else
cout<<1<<endl;
}
else
if(level>=11&&level<=29)
{
if(occupation==2)
{
point=1+(level-8)*3;
cout<<point<<endl;
}
else
point=1+(level-10)*3;
cout<<point<<endl;
}
else
if(level>=30&&level<=69)
{
if(occupation==2)
{
point=1+(level-8)*3+1;
cout<<point<<endl;
}
else
point=1+(level-10)*3+1;
cout<<point<<endl;
}
else
if(level>=70&&level<=119)
{
if(occupation==2)
{
point=1+(level-8)*3+1+1;
cout<<point<<endl;
}
else
point=1+(level-10)*3+1+1;
cout<<point<<endl;
}
else
if(level>=120)
{
if(occupation==2)
{
point=1+(level-8)*3+1+1+3;
cout<<point<<endl;
}
else
point=1+(level-10)*3+1+1+3;
cout<<point<<endl;
}
}
system("pause");
return 0;
}