#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <iterator>
#include <array>
#include <stdio.h>
#include <string.h>
#include <cstddef>
#include <string>
#include <sstream>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
 
using std::vector; using std::cout; using std::endl;
using std::cin; using std::string; using std::end;
using std::begin; using std::stringstream;
using namespace std;

template<typename T>
std::vector<T> split(const std::string& line) {
    std::istringstream is(line);
    return std::vector<T>(std::istream_iterator<T>(is), std::istream_iterator<T>());
}

long long  nwd(long long a, long long b){
    long long  c;
    while(b != 0){
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

void add(long long *x1, long long *y1, long long *x2, long long *y2){
    long long bottom = (*y1) * (*y2);
    long long top = ((*x1) * (*y2)) + ((*x2) * (*y1));
    //cout << bottom << " " << top << endl;
    long long frac;
    if(bottom != 0||top != 0){
        frac = nwd(top,bottom);
    }else{
        frac = 1;
    }
    string sign = "";
    if(top * bottom < 0){
        sign = "-";
    }else{
        sign = "";
    }
    printf("%s%lld / %lld\n",sign.c_str(),abs(top/frac),abs(bottom/frac) );
}

void sub(long long *x1, long long *y1,long long *x2, long long *y2){
    long long bottom = (*y1) * (*y2);
    long long top = ((*x1) * (*y2)) - ((*x2) * (*y1));
    long long frac;
    if(bottom != 0||top != 0){
        frac = nwd(top,bottom);
    }else{
        frac = 1;
    }
    string sign = "";
    if(top * bottom < 0){
        sign = "-";
    }else{
        sign = "";
    }
    printf("%s%lld / %lld\n",sign.c_str(),abs(top/frac),abs(bottom/frac) );
}

void divi(long long *x1, long long *y1, long long *x2, long long *y2){
    long long top = (*x1) * (*y2);
    long long bottom = (*x2) * (*y1);
    long long frac;
    if(bottom != 0||top != 0){
        frac = nwd(top,bottom);
    }else{
        frac = 1;
    }
    string sign = "";
    if(top * bottom < 0){
        sign = "-";
    }else{
        sign = "";
    }
    printf("%s%lld / %lld\n",sign.c_str(),abs(top/frac),abs(bottom/frac) );
}

void mult(long long *x1, long long *y1, long long *x2, long long *y2){
    long long top = (*x1) * (*x2);
    long long bottom = (*y2) * (*y1);
    long long frac;
    if(bottom != 0||top != 0){
        frac = nwd(top,bottom);
    }else{
        frac = 1;
    }
    string sign = "";
    if(top * bottom < 0){
        sign = "-";
    }else{
        sign = "";
    }
    printf("%s%lld / %lld\n",sign.c_str(),abs(top/frac),abs(bottom/frac) );
}

int main()
{

    int numOp;
    scanf("%d", &numOp);
    while(numOp != 0){
        long long x1,x2,y1,y2;
        char op[2];
        scanf("%lld %lld %s %lld %lld", &x1, &y1, op, &x2, &y2);
        if( op[0] == '+'){
            add(&x1, &y1, &x2,&y2);
        }
        else if(op[0] == '-'){
            sub(&x1,&y1,&x2,&y2);
        }
        else if(op[0] == '/'){
            divi(&x1,&y1,&x2,&y2);
        }
        else{
            mult(&x1,&y1,&x2,&y2);
        }
        numOp--;
    }
    return 0;   
}