#include <iostream>
using namespace std;
class Shape{
    public:
    virtual double calculateArea() const = 0;
    virtual bool isValid() const = 0;
    virtual ~Shape() = default;
};
class Square : public Shape{
    private:
    double side;
    public:
    Square(double s) : side(s){}
    bool isValid() const override{
        return side >= 0;
    }
    double calculateArea() const override {
        return side * side;
    }
};
class Rectangle : public Shape{
    double length;
    double width;
    public:
    Rectangle(double l, double w) : length(l), width(w){}
    bool isValid() const override {
        return length >= 0 && width >= 0;
    }
    double calculateArea() const override{
        return length * width;
    }
};
class Circle  : public Shape{
    private:
    double radius;
    public:
    Circle(double r) : radius(r) {}
    bool isValid() const override {
        return radius >= 0;
    }
    double calculateArea() const override{
        return 3.14159 * radius * radius;
    }
};
int main(){
    int t;
    cin>>t;
    
    Shape* shape = nullptr;
    
    if(t==1){
        double side;
        cin>>side;
        shape = new Square(side);
    }
    else if(t==2){
        double length, width;
        cin>>length>>width;
        shape = new Rectangle(length, width);
    }
    else if(t==3){
        double radius;
        cin>>radius;
        shape = new Circle(radius);
    }
    if(shape != nullptr){
        if(shape->isValid()){
            cout<<shape->calculateArea()<<endl;
        }
        else{
            cout<<"Invalid input"<<endl;
        }
        delete shape;
        }else{
            cout<<"Invalid input";
        }
    }
    return 0;
}