import java.io.;
import java.lang.;
class atm
{
public static void main(String[] args)
{
double x=0.0,z=0.0,y=0.0;
x=Double.parseDouble((args[0]));
y=Double.parseDouble((args[1]));
if((x%5)==0 && x<=y)
{
if(x>0 && x<=2000 && y>=0 && y<=2000.00 )
{
z=y-(double)x-0.5;
if(z>=0)
System.out.println(z);
else
System.out.println(y);
}
}
else
{
System.out.println(y);
}
}
}