Var
mas: array[1..4] of integer;
h,sum,proz:integer;
begin
h:=1;
sum:=0;
proz:=1;
for var i := 1 to 4 do read(mas[i]);
if ( mas[1] mod mas[2] ) >= ( mas[3] mod mas[4] ) then for var j := 2 to 5 do
begin
mas[h] := mas[h] + j;
h:= h+1;
end
else
begin
for var i := 1 to 4 do
begin
proz:=mas[i] * proz;
sum:= sum+ mas[i];
end;
sum:= sum / 2;
end;
end.