#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
int position(string &s) {
int res = 0;
while (s[res] != '/') {
res++;
}
return res;
}
pair<long, long> fun(string &s, int p) {
long a = 0, b = 0;
for (int i = 0; i < p; i++) {
a = a * 10 + (s[i] - '0');
}
for (int i = p + 1; i < s.length(); i++) {
b = b * 10 + (s[i] - '0');
}
return {a, b};
}
int gcb(long a, long b) {
return b ? gcb(b, a % b) : a;
}
int main() {
string s1, s2;
getline(cin, s1);
getline(cin, s2);
long molecule = 1;
long denominator = 1;
long s1_m, s1_d, s2_m, s2_d;
int s1_p, s2_p;
s1_p = position(s1);
s2_p = position(s2);
s1_m = fun(s1, s1_p).first;
s1_d = fun(s1, s1_p).second;
s2_m = fun(s2, s2_p).first;
s2_d = fun(s2, s2_p).second;
molecule = s1_m * s2_m;
denominator = s1_d * s2_d;
long common_divisor = gcb(molecule, denominator);
molecule = molecule / common_divisor;
denominator = denominator / common_divisor;
printf("%ld %ld\n", denominator, molecule);
return 0;
}