#include<iostream>
#include<cstdio>
using namespace std;
int shang[2001],xia[2001],che[2001];
int main()
{ //freopen("station.in","r",stdin);
//freopen("station.out","w",stdout);
int a,n,m,x;
long long y;
cin>>a>>n>>m>>x;
if(n==5)
y=m-2*a;
if(n==6)
y=m-3*a;
if(n==7)
y=(m-4*a)/4;
if(n==8)
y=(m-6*a)/7;
if(n==9)
y=(m-9*a)/12;
if(n==10)
y=(m-14*a)/20;
if(n==11)
y=(m-22*a)/33;
if(n==12)
y=(m-35*a)/54;
if(n==13)
y=(m-56*a)/88;
if(n==14)
y=(m-90*a)/143;
if(n==15)
y=(m-145*a)/233;
if(n==16)
y=(m-234*a)/376;
if(n==17)
y=(m-378*a)/609;
if(n==18)
y=(m-611*a)/986;
if(n==19)
y=(m-988*a)/1596;
if(n==20)
y=(m-1598*a)/2583;
if(x==n)
x=x-1;
if(x==1)
cout<<a;
if(x==2)
cout<<a;
if(x==3)
cout<<2*a;
if(x==4)
cout<<2*a+y;
if(x==5)
cout<<3*a+2*y;
if(x==6)
cout<<4*a+4*y;
if(x==7)
cout<<6*a+7*y;
if(x==8)
cout<<9*a+12*y;
if(x==9)
cout<<14*a+20*y;
if(x==10)
cout<<22*a+33*y;
if(x==11)
cout<<35*a+54*y;
if(x==12)
cout<<56*a+88*y;
if(x==13)
cout<<90*a+143*y;
if(x==14)
cout<<145*a+232*y;
if(x==15)
cout<<234*a+376*y;
if(x==16)
cout<<378*a+609*y;
if(x==17)
cout<<611*x+986*y;
if(x==18)
cout<<988*a+1596*y;
if(x==19)
cout<<1598*a+2583*y;
return 0;
}