import java.io.*;
public class Main {
/**
* @param args
*/
public static void main(String[] args) throws java.lang.Exception{
// TODO Auto-generated method stub
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String input = r.readLine();
String[] parts = input.split(" ");
String first = parts[0];
String second = parts[1];
int withdrawal = Integer.parseInt(first);
int balance = Integer.parseInt(second);
if (withdrawal % 5 != 0 || (double)withdrawal + .5 > balance)
System.out.printf("%.2f",balance);
else
System.out.printf("%.2f",(double)balance - withdrawal + .5);
}
}