program sumcount;
var
n,a,b,p,i,ans,nb,a1,nba,b1,ba:longint;
begin
assign(input,'sumcount.in');
assign(output,'sumcount.out');
reset(input);
rewrite(output);
readln(n,a,b,p);
nb:=1;
a1:=1;
nba:=1;
b1:=1;
ba:=1;
for i:=1 to n+b do nb:= nb*i;
for i:=1 to a do a1:=a1*i;
for i:=1 to (n+b-a) do nba:=nba*i;
for i:=1 to b do b1:=b1*i;
for i:=1 to b-a do ba:=ba*i;
ans:=(nb div(a1*nba)-b1 div(a1*ba)) mod p;
writeln(ans);
close(input);
close(output);
end.