#include <iostream>
#include <cmath>
using namespace std;
int n,a[50];
double p,res=0;
double f(int k){
return a[n]*pow(p,k)*pow(1-p,n-k)/(a[k]*a[n-k]);
}
int main(){
cin>>n>>p;
a[0]=1;
for(int i=1;i<=n;i++){
a[i]=i*a[i-1];
}
for(int k=0;k<=n;k++){
cout<<k<<":"<<f(k)<<endl;
res+=f(k);
}
cout<<res;
return 0;
}