#include<iostream>
using namespace std;
const int max=100;
typedef struct{
char upnum[max];
char downnum[max];
int upnumlength;
int downnumlength;
} fraction;
fraction getnum(char* parray);
fraction getresult(fraction f1,fraction f2);
int main()
{
char num1[max];
char num2[max];
cin>>num1>>num2;
fraction mynum1=getnum(num1);
fraction mynum2=getnum(num2);
fraction result=getresult(mynum1,mynum2);
int i;
for(i=0;i<result.upnumlength;i++) cout<<result.upnum[i];
cout<<"/";
for(i=0;i<result.downnumlength;i++) cout<<result.downnum[i];
int y;
cin>>y;
}
//返回分子分母
fraction getnum(char* parray)
{
fraction mynum;
mynum.downnumlength=0;
mynum.upnumlength=0;
int i=0;
int numlength=strlen(parray);
while(parray[i]!='/'){
mynum.upnum[i]=parray[i];//取分子
i++;
mynum.upnumlength++;
}
mynum.upnum[i]='\0';
int j=0;
i++;
while(i<numlength){
mynum.downnum[j]=parray[i];//取分母
i++;
j++;
mynum.downnumlength++;
}
mynum.downnum[j]='\0';
return mynum;
}
//分母加法换算
fraction getresult(fraction f1,fraction f2)
{
int upnum1,upnum2;
int downnum1,downnum2;
int downnum,upnum;
fraction result;
upnum1=atoi(f1.upnum);
downnum1=atoi(f1.downnum);
upnum2=atoi(f2.upnum);
downnum2=atoi(f2.downnum);
if(downnum1%downnum2==0){
downnum=downnum1;
upnum=upnum1+upnum2;
}else if(downnum2%downnum1==0){
downnum=downnum2;
upnum=upnum1+upnum2;
}else {//这里有个求最大公倍数先空着,一时想不出
downnum=downnum2*downnum1;
upnum=upnum1*downnum2+upnum2*downnum1;
}
itoa(downnum,result.downnum,10);
itoa(upnum,result.upnum,10);
result.downnumlength=strlen(result.downnum);
result.upnumlength=strlen(result.upnum);
return result;
}