#include "stdio.h"
int main()
{
float money;
float k1;
int year, hour;
scanf("%d %d", &year, &hour);
if (year < 5)
k1 = 30;
else
k1 = 50;
if (hour > 40)
money = 40 * k1 + (hour - 40) * k1 * 1.5f;
else
money = hour * k1;
printf("%.2f", money);
return 0;
}