int main()

{

using namespace std;

long n;

long k;

double p,q,y;

cin >> n ;

cin >> p;

//double b[n+1];

double *b;

b = new double[n+1];

q = 1 - p;

y = p/q;

b[0] = pow(q,n);

for (k = 1; k < n; k++) //here you probably forgot k++

{

b[k] = ((n-k+1)*b[k-1]* y )/ k;

}

return 0;

}