#include "testlib.h"
using namespace std;
int a[4];

int gcd(int x, int y) 
{   if (y == 0) return x; 
    return gcd(y, x % y); 
}

int main()
{   registerValidation();

    for(int i = 0; i < 4; i = i + 2)
    {    a[i] = inf.readInt(1,1000000);
         inf.readSpace();
         a[i + 1] = inf.readInt(1,1000000);
         inf.readEoln();
         int d = gcd(a[i], a[i + 1]);
         if (d != 1) quitf(_pe, "%d / %d - reducible fraction", a[i], a[i + 1]);
    }
    
    if (a[0] * a[3] == a[1] * a[2]) quitf(_pe, "fractions %d/%d and %d/%d is equal", a[0], a[1], a[2], a[3]);
    inf.readEof();
    return 0;
    
}