include
using namespace std;
int main()
{
double x,y,o,mod;
cin>>x;
cin>>y;
mod=y;
while(mod>=x)
{mod = mod-x;
}
// cout<<"mod is"<<mod;
if(mod==0.00)
{
if(y>x)
{ //cout<<x<<" "<<y;
o= ((y-x)-0.50);
//cout<<o;
}
else
{
o=y;
}
}
else
{
o=y;
}
cout<<o;
return 0;
}