#include <stdio.h>
long getgcd(long a, long b) {
return b == 0 ? a : getgcd(b, a % b);
}
void printfrac(long n, long d) {
if(d == 0) {
printf("Inf");
return;
}
int isNegative = 0;
if(n < 0) {
n = -n;
isNegative = !isNegative;
}
if(d < 0) {
d = -d;
isNegative = !isNegative;
}
long gcd = getgcd(n, d);
n /= gcd;
d /= gcd;
if(isNegative) {
printf("(-");
}
if(n / d && n % d) {
printf("%ld %ld/%ld", n / d, n % d, d);
} else if (n % d) {
printf("%ld/%ld", n % d, d);
} else {
printf("%ld", n / d);
}
if(isNegative) {
printf(")");
}
}
int main() {
long a1, b1, a2, b2;
scanf("%ld/%ld %ld/%ld", &a1, &b1, &a2, &b2);
char op[4] = {'+', '-', '*', '/'};
for(int i = 0; i < 4; i++) {
printfrac(a1, b1);
printf(" %c ", op[i]);
printfrac(a2, b2);
printf(" = ");
switch(op[i]) {
case '+':
printfrac(a1 * b2 + a2 * b1, b1 * b2);
break;
case '-':
printfrac(a1 * b2 - a2 * b1, b1 * b2);
break;
case '*':
printfrac(a1 * a2, b1 * b2);
break;
case '/':
printfrac(a1 * b2, b1 * a2);
break;
}
printf("\n");
}
return 0;
}