#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
class PhanSo{
private:
ll tu, mau;
public:
PhanSo(ll tu, ll mau);
friend istream& operator >> (istream& in, PhanSo& x);
friend ostream& operator << (ostream& out, PhanSo x);
friend PhanSo operator + (PhanSo a, PhanSo b);
};
PhanSo::PhanSo(ll tu, ll mau){
this->tu = tu;
this->mau = mau;
}
istream& operator >> (istream& in, PhanSo& x){
in >> x.tu >> x.mau;
return in;
}
ostream& operator << (ostream& out, PhanSo x){
out << x.tu << "/" << x.mau;
return out;
}
PhanSo operator + (PhanSo a, PhanSo b){
PhanSo t(1,1);
ll mau_chung = a.mau * b.mau;
ll tu_chung = a.tu * b.mau + a.mau * b.tu;
ll gcd = __gcd(mau_chung, tu_chung);
t.tu = tu_chung / gcd;
t.mau = mau_chung / gcd;
return t;
}
int main() {
PhanSo p(1,1), q(1,1);
cin >> p >> q;
cout << p + q;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgZW5kbCAiXG4iCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGxsOwpjb25zdCBpbnQgbW9kID0gMWU5ICsgNzsKCmNsYXNzIFBoYW5Tb3sKCXByaXZhdGU6CgkJbGwgdHUsIG1hdTsKCXB1YmxpYzoKCQlQaGFuU28obGwgdHUsIGxsIG1hdSk7CgkJZnJpZW5kIGlzdHJlYW0mIG9wZXJhdG9yID4+IChpc3RyZWFtJiBpbiwgUGhhblNvJiB4KTsKCQlmcmllbmQgb3N0cmVhbSYgb3BlcmF0b3IgPDwgKG9zdHJlYW0mIG91dCwgUGhhblNvIHgpOwoJCWZyaWVuZCBQaGFuU28gb3BlcmF0b3IgKyAoUGhhblNvIGEsIFBoYW5TbyBiKTsKfTsKClBoYW5Tbzo6UGhhblNvKGxsIHR1LCBsbCBtYXUpewoJdGhpcy0+dHUgPSB0dTsKCXRoaXMtPm1hdSA9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