#include<iostream>
#include<string>
#include<cmath>
using namespace std;
long long gcd(long long a, long long b) {
return b == 0 ? a : gcd(b, a % b);
}
struct fraction {
long long up, down;
fraction(long long u, long long d) {
up = u;
down = d;
}
};
//返回最简的分数
fraction reduce(fraction f) {
long long c = gcd(f.up, f.down);
f.up /= c;
f.down /= c;
return f;
}
fraction add(fraction a, fraction b) {
fraction res(0, 1);
long long common = gcd(a.down, b.down);
res.up = a.up * (b.down / common) + b.up * (a.down / common);
res.down = a.down / common * b.down;
return res;
}
string getString(fraction f) {
if (f.up == 0) {
return "0";
}
string res;
bool negative = false;
if (f.up < 0) {
f.up = -f.up;
negative = true;
}
long long integer = f.up / f.down;
f.up %= f.down;
if (integer != 0) {
res += to_string(integer);
if (f.up != 0) {
res += " ";
}
}
if (f.up != 0) {
res += to_string(f.up) + "/" + to_string(f.down);
}
if (negative) {
res = "-" + res;
}
return res;
}
int main() {
int numInput;
cin >> numInput;
fraction res(0, 1);
for (int i = 0; i < numInput; i++) {
fraction temp(0, 1);
scanf("%lld/%lld", &temp.up, &temp.down);
temp = reduce(temp);
res = add(res, temp);
res = reduce(res);
}
string s = getString(res);
cout << s;
}