using namespace std;

#ifndef _Rational_hpp_
#define _Rational_hpp_

class Rational
{
      public:
             int arithmitis;
             int paronomastis;
             
             void set(int x, int y)
             {
                  arithmitis = x;
                  paronomastis = y;
             }
             
             void addition(Rational r1, Rational r2)
             {
                  arithmitis = r1.arithmitis*r2.paronomastis + r2.arithmitis*r1.paronomastis;
                  paronomastis = r1.paronomastis * r2.paronomastis;
             }
             
             void subtraction(Rational r1, Rational r2)
             {
                  arithmitis = r1.arithmitis*r2.paronomastis - r2.arithmitis*r1.paronomastis;
                  paronomastis = r1.paronomastis * r2.paronomastis;
             }

             void multiplication(Rational r1, Rational r2)
             {
                  arithmitis = r1.arithmitis * r2.arithmitis;
                  paronomastis = r1.paronomastis * r2.paronomastis;
             }
            
             void printr()
             {
                  std::cout << arithmitis << "/" << paronomastis << endl;
             }
             
             void print()
             {
                  std::cout << (double)arithmitis/paronomastis << endl;
             }
};

Rational inverse(Rational r1)
{
         Rational r2;
         r2.arithmitis = r1.paronomastis;
         r2.paronomastis = r1.arithmitis;
                      
         return (r2);
}
#endif
