#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
float y;
short x;
scanf("%d %f",&x,&y);
if(x<=0&&x>2000)
exit(0);
if(y<0&&y>2000)
exit(0);
if(x>y)
{
printf("%0.2f",y);
}
else if(x%5!=0)
{
printf("%0.2f",y);
}
else
{
y=y-x-0.50;
printf("%0.2f",y);
}
}