#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int gcd(int q,int r)
{
if(r==0) return q;
if(q==0) return r;
if(r==1||q==1) return 1;
else return gcd(r,q%r);
}
void fs1(int x,int y,int q,int r)
{
int lcm=y*r/gcd(y,r);
x=lcm/y*x;
q=lcm/r*q;
int fenzihe=x+q;
int hehe=gcd(fenzihe,lcm);
if(fenzihe%lcm==0)
{
{
printf("%d\n",fenzihe/lcm);
return;
}
}
if(hehe==1)
{
if(fenzihe%lcm==0)
{
if(fenzihe==0) printf("0\n");
}
else
{
printf("%d/%d\n",fenzihe,lcm);
return;
}
}
else printf("%d/%d\n",fenzihe/hehe,lcm/hehe);
}
void fs2(int x,int y,int q,int r)
{
int lcm=y*r/gcd(y,r);
x=lcm/y*x;
q=lcm/r*q;
int fenzihe=x-q;
int hehe=gcd(fenzihe,lcm);
if(fenzihe%lcm==0)
{
{
printf("%d\n",fenzihe/lcm);
return;
}
}
if(hehe==1)
{
{
printf("%d/%d\n",fenzihe,lcm);
return;
}
}
else
{
if(fenzihe==0)
{
printf("0\n");return;
}
printf("%d/%d\n",fenzihe/abs(hehe),lcm/abs(hehe));
}
}
int main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
int a,b,c,d;
char i,j,k;
while(scanf("%d%c%d%c%d%c%d",&a,&j,&b,&i,&c,&k,&d)!=EOF)
{
if(i=='+')
fs1(a,b,c,d);
else fs2(a,b,c,d);
}
return 0;
}