#include <bits/stdc++.h>
using namespace std;
class frac
{
private:
    int deno,nume;

public:
    frac(int x=1,int y=1):deno(x),nume(y) {}
    void setdeno(int r)
    {
        deno=r;
    }
    void setnume(int l)
    {
        nume=l;
    }
    friend frac operator+(const frac &a,const frac &b)
    {
        int k=a.nume*b.nume;
        int t=a.deno*b.nume+b.deno*a.nume;
        int d=__gcd(k,t);
        frac c;
        c.deno=t/d;
        c.nume=k/d;
        return c;
    }
    friend frac operator*(const frac &a,const frac &b)
    {
        frac c;
        c.deno=a.deno*b.deno;
        c.nume=a.nume*b.nume;
        int d=__gcd(c.deno,c.nume);
        c.deno/=d;
        c.nume/=d;
        return c;
    }
    friend frac operator/(const frac &a,const frac &b)
    {
        frac c;
        c.deno=a.deno*b.nume;
        c.nume=a.nume*b.deno;
        int d=__gcd(c.deno,c.nume);
        c.deno/=d;
        c.nume/=d;
        return c;
    }
    friend frac operator-(const frac &a,const frac &b)
    {
        int k=a.nume*b.nume;
        int t=a.deno*b.nume-b.deno*a.nume;
        int d=__gcd(k,t);
        frac c;
        c.deno=t/d;
        c.nume=k/d;
        return c;
    }
    void show()
    {
        printf("%d/%d \n",deno,nume);
    }
    friend istream &operator>>( istream  &input, frac &D )
    {
        input >> D.deno >> D.nume;
        return input;
    }
    friend ostream &operator<<( ostream &output,const frac &D )
    {
        output << "fraction is : " << D.deno << " /" << D.nume;
        return output;
    }
};
// istream& operator >>(istream &s,frac &a)
// {
// cout<<"请输入一个分数"<<endl;
// s>>deno>>nume;
// a.deno=deno;
// b.deno=nume;
// return s;
// }
int main()
{
    frac a,c;
    cin>>a>>c;
    frac ans1,ans2,ans3,ans4;
    ans1=a*c;
    ans2=a+c;
    ans3=a/c;
    ans4=a-c;
    cout<<ans1<<endl;
    cout<<ans2<<endl;
    cout<<ans3<<endl;
    cout<<ans4<<endl;
    return 0;
}