import java.text.DecimalFormat;
import java.util.Scanner;
class mm
{
public static void main(String args[])
{
int w;
Double bal;
Scanner in=new Scanner(System.in);
w=in.nextInt();
bal=in.nextDouble();
if(w<=2000&&w>0&&w%5==0&&w<=bal)
{
if(bal<=2000 && bal>=0)
bal=(bal-w)-0.5;
}
DecimalFormat df = new DecimalFormat("#.00");
System.out.println( df.format(bal));
}
}