double agm( double a, double g ) {
   
   double iota = 1.0E-16;
   double a1, g1;

   if( a*g < 0.0 ) {
      printf(  );
      exit(1);
   }

   while( fabs(a-g)>iota ) {
      a1 = (a + g) / 2.0;
      g1 = sqrt(a * g);

      a = a1;
      g = g1;
   }

   return a;
}

int main( void ) {
   double x, y;
   printf(  );
   scanf( , &x, &y );
   printf( , agm(x, y) );
   return 0;
}