

#include <cstdint>
#include <iostream>
#include <iomanip>


using namespace std;


class fixedpoint_t {
	public:
		int32_t v;
		fixedpoint_t(int32_t x = 0) : v(x << 16) { };
		inline fixedpoint_t &operator = (const int32_t &x) { this->v = x << 16; return *this; };
		inline fixedpoint_t operator + (const fixedpoint_t &x) { fixedpoint_t ret; ret.v = this->v + x.v; return ret; };
		inline fixedpoint_t operator - (const fixedpoint_t &x) { fixedpoint_t ret; ret.v = this->v - x.v; return ret; };
		inline fixedpoint_t operator * (const fixedpoint_t &x) { fixedpoint_t ret; ret.v = (((int64_t) this->v) * ((int64_t) x.v)) >> 16; return ret; };
		inline fixedpoint_t operator / (const fixedpoint_t &x) { fixedpoint_t ret; ret.v = (((int64_t) this->v) << 16) / ((int64_t) x.v); return ret; };
};


ostream &operator << (ostream &os, const fixedpoint_t &x) {
	os << (((double) x.v) / 65536.0);
	return os;
}


fixedpoint_t fWithOperators(fixedpoint_t a, fixedpoint_t b) {
	return (a * b) + (a / b);
}


typedef int32_t fixedpoint_ct;


#define  FP_MUL(x, y)        ((int32_t) ((((int64_t) (x)) * ((int64_t) (y))) >> 16))
#define  FP_DIV(x, y)        ((int32_t) ((((int64_t) (x)) << 16) / ((int64_t) (y))))
#define  TO_FP(x)            (((int32_t ) (x)) << 16)
#define  FP_TO_DOUBLE(x)     (((double) (x)) / 65536.0)


fixedpoint_ct fWithMacros(fixedpoint_ct a, fixedpoint_ct b) {
	return FP_MUL(a, b) + FP_DIV(a, b);
}


int main() {
	cout << fWithOperators(4, 3) << endl;
	cout << FP_TO_DOUBLE(fWithMacros(TO_FP(4), TO_FP(3))) << endl;
	return 0;
}

