public class J1
{
public static double Fd(double H,double r1,double r2)
{
int counter=0;
int n=10000000;
double teta1=Math.atan(r1/H);
double teta2=Math.atan(r2/H);
double teta=0;
double A=Math.PI/2.0;
for(int i=0;i<n;i++)
{teta=A*Math.random();
 if(teta>=teta1 && teta<=teta2) counter++;
}
double f=(double)counter/(double)n;
return f;
}

public static double Fd1(double H,double r2)
{
double H1=H/r2;
return 1/(H1*H1+1);
}

public static void main(String arg[])
{
double H=2.0;
double r1=0.0;
double r2=2.0;
double F=Fd(H,r1,r2);
double F1=Fd1(H,r2);
System.out.println("f="+F+"f1="+F1);
}
}