S002-AC.cc 415 Bytes
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
	int n;
	double a,b,r;
	string str;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> str;
		if(str == "rectangle")
		{
			cin >> a;
			cin >> b;
			cout << fixed << setprecision(6) << a*b << endl;
		}
		else
		{
			cin >> r;
			cout << fixed << setprecision(6) << M_PI*r*r << endl;
		}
	}
	return 0;

}