#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
struct Fraction {
LL up,down;
} ans1,ans2,ans3,ans4,x,y;
LL gcd(LL a,LL b) {
return b==0?a:gcd(b,a%b);
}
Fraction reduction(Fraction a) {
if(a.down<0) {
a.up=-a.up;
a.down=-a.down;
}
if(a.up==0) {
a.down=1;
} else {
LL d=gcd(abs(a.up),a.down);
a.up/=d;
a.down/=d;
}
return a;
}
Fraction Add(Fraction a,Fraction b) {
Fraction c;
c.up=a.up*b.down+b.up*a.down;
c.down=a.down*b.down;
return reduction(c);
}
Fraction Sub(Fraction a,Fraction b) {
Fraction c;
c.up=a.up*b.down-b.up*a.down;
c.down=a.down*b.down;
return reduction(c);
}
Fraction Mul(Fraction a,Fraction b) {
Fraction c;
c.up=a.up*b.up;
c.down=a.down*b.down;
return reduction(c);
}
Fraction Div(Fraction a,Fraction b) {
Fraction c;
c.up=a.up*b.down;
c.down=a.down*b.up;
return reduction(c);
}
void Printf(Fraction a) {
a=reduction(a);
if(a.up<0) cout<<'(';
if(a.down==1) {
cout<<a.up;
} else if(abs(a.up)>a.down) {
cout<<a.up/a.down<<" "<<abs(a.up)%a.down<<'/'<<a.down;
} else {
cout<<a.up<<'/'<<a.down;
}
if(a.up<0) cout<<')';
}
int main() {
scanf("%lld/%lld %lld/%lld",&x.up,&x.down,&y.up,&y.down);
ans1=Add(x,y);
ans2=Sub(x,y);
ans3=Mul(x,y);
Printf(x);cout<<" + ";Printf(y);cout<<" = ";Printf(ans1);cout<<endl;
Printf(x);cout<<" - ";Printf(y);cout<<" = ";Printf(ans2);cout<<endl;
Printf(x);cout<<" * ";Printf(y);cout<<" = ";Printf(ans3);cout<<endl;
Printf(x);cout<<" / ";Printf(y);cout<<" = ";if(y.up==0) printf("Inf");else Printf(Div(x,y));
return 0;
}