#include<stdio.h>
int main()
{
float bal,output;
int input;
scanf("%d %f",&input,&bal);
if(input>=0 && input<=bal+0.5 && input<=bal)
{
if(input%5==0)
{
output=bal-input-0.5;
printf("\n%.2f\n",output);
}else
printf("%.2f",bal);
}
}