#include<bits/stdc++.h>
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<algorithm>
#include<stack>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
double t;int n;
double ans;
ll mypow(int a,int b)
{
ll res=1;
while(b--)res*=a;
return res;
}
double f[33];
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif // ONLIN
double p0,p1;
while(cin>>n>>t)
{
if(n==0)break;
f[n]=1.0*mypow(2,n);
for(int i=n-1;i>=0;i--)
{
p0=max(t,1.0*mypow(2,i)/f[i+1]);
p1=(p0-t)/(1-t);
f[i]=mypow(2,i)*p1+(1+p0)/2*f[i+1]*(1-p1);
}
printf("%.3f
",f[0]);
}
}