#include<stdio.h>
#include<math.h>

static double f (double x)
{
return (acos(x)*acos(x)*exp(atan(x)));
}

void main (void)
{
static double I, I1, a, b, h, S[3], d;
int j, N;
printf("Enter the left border of integration: ");
scanf("%lf",&a);
printf("Enter the right border of integraton: ");
scanf("%lf",&b);
printf("Enter the precision of calculations: ");
scanf("%lf",&d);
S[0]=f(a)+f(b);
N=1;
S[2]=0;
h=(b-a)/2;
I=S[0]*h/2;
do {I1=I; S[1]=0; 
    for (j=0;j<N;j++)
    S[1]+=f(a+h*(2*j+1));
    I=h*(S[0]+4*S[1]+2*S[2]); I=I/3;
    S[2]+=S[1];
    N=2*N;
    h=h/2;
   }
while (fabs(I-I1)>d);
printf("The value of the integral is: ");
printf("%4.10lf",I);
}