#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,a,x,up[66]={},pe[66]={};
cin >> a >> n >> m >> x;
up[1] = a;
if (x == 1 || x == 2)
{
cout << a;
return 0;
}
for (int i = 0; i <= m; i++)
{
up[2] = i;
for (int j = 3; j <= n; j++)
{
up[j] = up[j-1] + up[j-2];
pe[j] = up[j] - up[j-1];
}
if (pe[n] == m)
break;
}
cout << pe[x];
return 0;
}