function S=S(z,l)
syms z l;
R=23.5;
r=21.5;
H=78;
k=tan(l);
a=H/((R+r)^2-2*R*(R+r));
b=-2*R/((R+r)^2*R*(R+r));
y1=-b-sqrt(b^2+4*a*z);
y2=-b+sqrt(b^2+4*a*z);
r1=y1+b/(2*a);
r2=-b/(2*a)-y2;
R1=y1-R;
a1=acos(R1/r1);
a2=acos(R1/r2);
if z<=H & z>(-b*k/(2*a))
S=pi*R1*(2*pi-2*a1)/(2*pi)+r1*sqrt(R1^2-r1^2);
else if z==-b*k/(2*a)
S=1/2*pi*R1^2;
else if z>0 & z<(-b*k/(2*a))
S=pi*R1^2-(pi*R1^2*(2*pi-2*a2)/(2*pi)+r2*sqrt(R1^2-r2^2));
end
end
end