#include <iostream>
using namespace std;
double f(int,int);
int main()
{
int n,x;
cout<<"please enter n,x";
cin>>n>>x;
cout<<f(n,x)<<endl;
system("pause");
return 0;
}
double f(int n,int x)
{
double s=0;
if(n==0) s=1;
else if(n==1) s=x;
else s=((2*n-1)*x-f(n-1,x)-(n-1)*f(n-2,x))/2;
return s;
}