#include <iostream>

using namespace std;

class Polygon {
  public:
    Polygon(int w = 0, int h = 0);
    void set(int w, int h); 
  protected:
    int width;
    int height;
};

class Rectangle: public Polygon {
  public:
    int area() const;
};

class Triangle: public Polygon {
  public:
    float area() const;
};


Polygon::Polygon(int w, int h) {
    this->set(w, h);
}

void Polygon::set(int w, int h) {
    this->width = w;
    this->height = h;
}
 

int Rectangle::area() const {
    return this->width * this->height;
}     
      
float Triangle::area() const {
    return this->width * this->height / 2;
}     

      
int main () {
  Polygon p;
  Rectangle r;
  Triangle t;
  
  r.set(4, 5);
  t.set(4, 5);
  
  cout << r.area() << endl;
  cout << t.area() << endl;
  
  return 0;
}
