#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <math.h>
#include <algorithm>
using namespace std;
long long gcd ( long long t1, long long t2)
{
return t2 == 0 ? t1 : gcd ( t2, t1% t2) ;
}
void operate ( long long t1, long long t2)
{
if ( t2 == 0 )
cout << "Inf" ;
else
{
long long a, b, k;
k = gcd ( abs ( t1) , t2) ;
t1 = t1 / k;
t2 = t2 / k;
a = abs ( t1) / t2;
b = abs ( t1) - a * t2;
if ( t1 < 0 )
{
if ( a&& b)
cout << "(" << "-" << a << ' ' << b << "/" << t2<< ")" ;
else if ( a && ! b)
cout << "(" << "-" << a<< ")" ;
else if ( ! a&& b)
cout << "(" << "-" << b << "/" << t2<< ")" ;
else
cout << "0" ;
}
else
{
if ( a&& b)
cout << a << ' ' << b << "/" << t2;
else if ( a && ! b)
cout << a;
else if ( ! a&& b)
cout << b << "/" << t2;
else
cout << "0" ;
}
}
}
int main ( )
{
long long a, b, c, d;
scanf_s ( "%lld/%lld" , & a, & b) ;
scanf_s ( "%lld/%lld" , & c, & d) ;
operate ( a, b) ;
cout << ' ' << "+" << ' ' ;
operate ( c, d) ;
cout << ' ' << "=" << ' ' ;
operate ( a* d + b * c, b* d) ;
cout << '\n' ;
operate ( a, b) ;
cout << ' ' << "-" << ' ' ;
operate ( c, d) ;
cout << ' ' << "=" << ' ' ;
operate ( a* d - b * c, b* d) ;
cout << '\n' ;
operate ( a, b) ;
cout << ' ' << "*" << ' ' ;
operate ( c, d) ;
cout << ' ' << "=" << ' ' ;
operate ( a* c , b* d) ;
cout << '\n' ;
operate ( a, b) ;
cout << ' ' << "/" << ' ' ;
operate ( c, d) ;
cout << ' ' << "=" << ' ' ;
if ( c < 0 )
operate ( a* d* abs ( c) / c, b* abs ( c) ) ;
else
operate ( a* d, b* c) ;
cout << '\n' ;
return 0 ;
}