#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(){
}
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;
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+CiNkZWZpbmUgZW5kbCAiXG4iCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGxsOwpjb25zdCBpbnQgbW9kID0gMWU5ICsgNzsKCmNsYXNzIFBoYW5Tb3sKCXByaXZhdGU6CgkJbGwgdHUsIG1hdTsKCXB1YmxpYzoKCQlQaGFuU28oKXsKCQl9CgkJUGhhblNvKGxsIHR1LCBsbCBtYXUpOwoJCWZyaWVuZCBpc3RyZWFtJiBvcGVyYXRvciA+PiAoaXN0cmVhbSYgaW4sIFBoYW5TbyYgeCk7CgkJZnJpZW5kIG9zdHJlYW0mIG9wZXJhdG9yIDw8IChvc3RyZWFtJiBvdXQsIFBoYW5TbyB4KTsKCQlmcmllbmQgUGhhblNvIG9wZXJhdG9yICsgKFBoYW5TbyBhLCBQaGFuU28gYik7Cn07CgpQaGFuU286OlBoYW5TbyhsbCB0dSwgbGwgbWF1KXsKCXRoaXMtP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