#include <bits/stdc++.h>
using namespace std;
long long numerator[1002002];
long long denomerator[1002002];
long long a,b,n,MOD;
long long power(long long b,long long p) {
if(p == 0)
return 1;
long long ans = power(b,p/2);
ans = (ans*ans) % MOD;
if(p % 2)
return (ans * b) % MOD;
return ans;
}
long long solve(long long num,long long den) {
return (num * power(den,MOD-2)) % MOD;
}
int main()
{
cin>>a>>b>>n>>MOD;
long long facA = a; //represents (a+k)! / (a-b) !
for(long long i = a-1;i>a-b;i--)
facA = (facA * i) % MOD;
long long facB = 1;
for(long long i = 2;i<=b;i++)
facB*=i;
//numerator[i] = (a+i)! / (a-b)!
//denominator[i] = (b+i)!
numerator[0] = facA;
denomerator[0] = facB;
long long ans = solve(facA,facB);
for(long long i = 1;i<=n;i++) {
numerator[i] = (numerator[i-1] * (a+i)) % MOD;
denomerator[i] = (denomerator[i-1] * (b+i)) % MOD;
ans = max(ans,solve(numerator[i],denomerator[i]));
}
cout<<ans;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpsb25nIGxvbmcgbnVtZXJhdG9yWzEwMDIwMDJdOwpsb25nIGxvbmcgZGVub21lcmF0b3JbMTAwMjAwMl07CmxvbmcgbG9uZyBhLGIsbixNT0Q7Cgpsb25nIGxvbmcgcG93ZXIobG9uZyBsb25nIGIsbG9uZyBsb25nIHApIHsKICAgIGlmKHAgPT0gMCkKICAgICAgICByZXR1cm4gMTsKICAgIGxvbmcgbG9uZyBhbnMgPSBwb3dlcihiLHAvMik7CiAgICBhbnMgPSAoYW5zKmFucykgJSBNT0Q7CiAgICBpZihwICUgMikKICAgICAgICByZXR1cm4gKGFucyAqIGIpICUgTU9EOwogICAgcmV0dXJuIGFuczsKfQoKbG9uZyBsb25nIHNvbHZlKGxvbmcgbG9uZyBudW0sbG9uZyBsb25nIGRlbikgewogICAgcmV0dXJuIChudW0gKiBwb3dlcihkZW4sTU9ELTIpKSAlIE1PRDsKfQoKaW50IG1haW4oKQp7CiAgICBjaW4+PmE+PmI+Pm4+Pk1PRDsKICAgIGxvbmcgbG9uZyBmYWNBID0gYTsgLy9yZXByZXNlbnRzIChhK2spISAvIChhLWIpICEKICAgIGZvcihsb25nIGxvbmcgaSA9IGEtMTtpPmEtYjtpLS0pCiAgICAgICAgZmFjQSA9IChmYWNBICogaSkgJSBNT0Q7CiAgICBsb25nIGxvbmcgZmFjQiA9IDE7CiAgICBmb3IobG9uZyBsb25nIGkgPSAyO2k8PWI7aSsrKQogICAgICAgIGZhY0IqPWk7CiAgICAvL251bWVyYXRvcltpXSA9IChhK2kpISAvIChhLWIpIQogICAgLy9kZW5vbWluYXRvcltpXSA9IChiK2kpIQogICAgbnVtZXJhdG9yWzBdID0gZmFjQTsKICAgIGRlbm9tZXJhdG9yWzBdID0gZmFjQjsKICAgIGxvbmcgbG9uZyBhbnMgPSBzb2x2ZShmYWNBLGZhY0IpOwogICAgZm9yKGxvbmcgbG9uZyBpID0gMTtpPD1uO2krKykgewogICAgICAgIG51bWVyYXRvcltpXSA9IChudW1lcmF0b3JbaS0xXSAqIChhK2kpKSAlIE1PRDsKICAgICAgICBkZW5vbWVyYXRvcltpXSA9IChkZW5vbWVyYXRvcltpLTFdICogKGIraSkpICUgTU9EOwogICAgICAgIGFucyA9IG1heChhbnMsc29sdmUobnVtZXJhdG9yW2ldLGRlbm9tZXJhdG9yW2ldKSk7CiAgICB9CiAgICBjb3V0PDxhbnM7CiAgICByZXR1cm4gMDsKfQo=