#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;
long double ln_fac[400051];
long double ln_C(int n,int m)
{
long double res=ln_fac[n]-ln_fac[m]-ln_fac[n-m];
return res;
}
int n;double p;
double ans=0;
int id=1;
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif // ONLIN23
ln_fac[1]=log(1);
for(int i=2;i<=400050;i++)ln_fac[i]=ln_fac[i-1]+log(i);
long double tmp;
while(cin>>n>>p)
{
if(fabs(p)<0.000000001||fabs(p-1)<0.000000001){printf("Case %d: %.6f
",id++,(double)n);continue;}
ans=0;
for(int i=0;i<=n;i++)
{
tmp=ln_C(2*n-i,n)+(n+1)*log(p)+(n-i)*log(1-p);
ans+=i*exp(tmp);
tmp=ln_C(2*n-i,n)+(n+1)*log(1-p)+(n-i)*log(p);
ans+=i*exp(tmp);
}
printf("Case %d: %.6f
",id++,ans);
}
}