'use strict';
(function(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  const N=input[0], p=input[1];
  const dp=new Array(N+2).fill(0).map((x,i)=>new Array(i+1).fill(0));
  dp[2][1]=1;
  for(let i=3;i<=N+2;i++){
    for(let j=1;j<=i-1;j++){
      dp[i][j]=p*dp[i-1][j-1]+(1-p)*dp[i-1][j];
    }
  }
  const ans=dp[N+2].reduce(function(ac,cr,id){
    if(id-1<N/2)return ac;
    return ac+cr;
  },0);
  console.log(ans);
})(require('fs').readFileSync('/dev/stdin','utf8'));