// Arup Guha
// 7/23/02
#include <iostream.h>
#include <fstream.h>
#include <math.h>

const double pi = 3.14159265358979;

void main() {

  ifstream fin("polygon.in");
  int n;
  double r;

  // Set up output format (2 places after the decimal).  
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(2);
  
  // Read in one line of data at a time.
  while (fin >> n >> r) {

    // Calculate angle needed for area computation.
    double theta = pi*(n-2)/(2*n); 

    // Calculate and output area.
    double area = r*r*n*sin(theta)*cos(theta);
    cout << "Area = " << area << endl;
  }
  fin.close();
}

/* 

Work for the formula:

   Area = a*p/2, where a is the apothem and p the perimeter.
   
   apothem = r*sin(x), where x is 1/2 the angle of the regular polygon.

   So, x = 90*(n-2)/n in degrees. 
   In radians, x = pi*(n-2)/(2*n). (Multiply degrees by pi/180.)

   perimeter = n*side

   side = 2*r*cos(x), using the same angle as before, so

   perimeter = n*2*r*cos(x)
   apothem = r*sin(x)

   Area = n*r*r*sin(x)*cos(x), with x defined above.

*/
