#include <memory>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cmath>

class Figure {
 public:
  virtual std::string Name() = 0;
  virtual double Perimeter() = 0;
  virtual double Area() = 0;
};

class Triangle : public Figure {
 public:
  Triangle(const int& one, const int& two, const int& three) {
    a = one;
    b = two;
    c = three;
  }
  std::string Name() {
    return "TRIANGLE";
  }
  double Perimeter() {
    return a + b + c;
  }
  double Area() {
    double p = (a + b + c) / 2.0;
    return sqrt(p * (p - a) * (p - b) * (p - c));
  }
 private:
  int a, b, c;
};

class Rect : public Figure {
 public:
  Rect(const int& one, const int& two) {
    a = one;
    b = two;
  }
  std::string Name() {
    return "RECT";
  }
  double Perimeter() {
    return 2.0 * (a + b);
  }
  double Area() {
    return a * b;
  }
 private:
  int a, b;
};

class Circle : public Figure {
 public:
  explicit Circle(const int& one) {
    a = one;
  }
  std::string Name() {
    return "CIRCLE";
  }
  double Perimeter() {
    return 2 * 3.14 * a;
  }
  double Area() {
    return 3.14 * a * a;
  }
 private:
  int a;
};

std::shared_ptr<Figure> CreateFigure(std::istringstream& is) {
  std::string fig;
  is >> fig;
  if (fig == "RECT") {
    int a, b;
    is >> a >> std::ws >> b;
    return std::make_shared<Rect>(a, b);
  } else if (fig == "TRIANGLE") {
    int a, b, c;
    is >> a >> std::ws >> b >> std::ws >> c;
    return std::make_shared<Triangle>(a, b, c);
  } else if (fig == "CIRCLE") {
    int a;
    is >> a;
    return std::make_shared<Circle>(a);
  }
}

int main() {
  std::vector<std::shared_ptr<Figure>> figures;
  for (std::string line; getline(std::cin, line); ) {
	std::istringstream is(line);
    std::string command;
    is >> command;
    if (command == "ADD") {
      is >> std::ws;
      figures.push_back(CreateFigure(is));
	} else if (command == "PRINT") {
      for (const auto& current_figure : figures) {
		std::cout << std::fixed << std::setprecision(3)
             << current_figure->Name() << " "
             << current_figure->Perimeter() << " "
             << current_figure->Area() << std::endl;
      }
    }
  }
  return 0;
}