#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include <cstdio>
void simplify(int &up, int &down)
{
if (up == 0) return;
int bigger = max(up, down), smaller = min(up, down);
while (bigger % smaller != 0) {
int tmp = smaller;
smaller = bigger % smaller;
bigger = tmp;
}
up = up / smaller; down = down / smaller;
}
void ope(char op,int up1, int down1, int up2, int down2,int &up,int &down)
{
if (op == '+') up = up1 * down2 + up2 * down1;
else up = up1 * down2 - up2 * down1;
down = down1 * down2;
}
void print(int up,int down)
{
if (up == 0) { cout << "0"; return; }
int flag = 1;
if (up < 0) {
up = -up;
flag = -1;
}
simplify(up, down);
if (down == 1) {
cout << up * flag; return;
}
cout << up * flag << "/" << down;
}
int main()
{
int up1, up2, down1, down2;
char op;
while (scanf("%d / %d %c %d / %d", &up1, &down1, &op, &up2, &down2) != EOF) {
int up, down;
ope(op, up1, down1, up2, down2, up, down);
print(up, down);
cout << endl;
}
return 0;
}