#include<stdio.h>
#include<stdlib.h>

int gcd(int x,int y)  
//欧几里得辗转相除法求两数的最大的公约数
{
    if(x<y)    return gcd(y,x);
    if(x%y!=0) return gcd(y,x%y);
    else return y;
}

void cal_formul(char* x,char* y,char* z)
{
	int a1,b1,a2,b2,c1,c2,g;
	char buf[20]={'\0'};
	int i=0;
	while(*x!='\0')
	{
		buf[i]=*x;
		if(*x=='/') break;
		i++;
		x++;
	}
	a1=atoi(buf);
	i=0;
	x++;
	while(*x!='\0')
	{
		buf[i]=*x;
		i++;
		x++;
	}
	b1=atoi(buf);
    ////////////////////////////////////
	i=0;
	while(*y!='\0')
	{
		buf[i]=*y;
		if(*y=='/') break;
		i++;
		y++;
	}
	a2=atoi(buf);
	i=0;
	y++;
	while(*y!='\0')
	{
		buf[i]=*y;
		i++;
		y++;
	}
	b2=atoi(buf);
	////////////////////////////////////////////////
	c1=a1*b2+b1*a2;
	c2=b1*b2;
	g=gcd(c1,c2);
	c1=(a1*b2+b1*a2)/g;
	c2=(b1*b2)/g;
	_itoa(c1,buf,10);
	i=0;
	while(buf[i]!='\0')
	{
		*z=buf[i];
		z++;
		i++;
	}
	*z='/';
	z++;
	_itoa(c2,buf,10);
	i=0;
	while(buf[i]!='\0')
	{
		*z=buf[i];
		z++;
		i++;
	}
}


int main()
{    
	char x[]="406/747";
	char y[]="678/555";
	char z[20]={'\0'};
	cal_formul(x,y,z);
	printf("%s + %s = %s\n",x,y,z);
	return 0;
}