#include<stdio.h>
int main()
{
int op,a,b,c,d,m,n;
scanf("%d%d%d%d%d",&op,&a,&b,&c,&d);
if(op==1)
{m=a*d+b*c;n=b*d;
}
if(op==0){
m=a*d-b*c;n=b*d;
}
if(m==0)printf("0/1");
else
{int n1=n,m1=m,t;
if(n1>m1){t=n1;n1=m1;m1=t;
}
int r=m1%n1;
if(r==0){;
}
else{do{m1=n1;
n1=r;
r=m1%n1;
}while(r!=0);
}
if(n/n1<0)
printf("%d/%d",-m/n1,-n/n1);
else
printf("%d/%d",m/n1,n/n1);
}
return 0;
}