using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication6
{
class Program
{
static int Main(string[] args)
{
Double x,y;
x = double.Parse(Console.ReadLine());
y = double.Parse(Console.ReadLine());
if (x > 0)
{
if (x % 5 == 0 && y - x > 0.5)
{
y-=0.5;
Console.Write(y - x);
}
else
{
Console.Write(y);
}
}
else
{
Console.Write(y);
}
Console.ReadLine();
return 0;
}
}
}