#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
struct frac{
ll up;
ll down;
};
ll gcd(ll a, ll b){
if(b == 0){
return a;
}
return gcd(b, a % b);
}
frac reduc(frac a){
if(a.down < 0){
a.down = -a.down;
a.up = -a.up;
}
if(a.up == 0){
a.down = 1;
}else{
ll d = gcd(abs(a.up), abs(a.down));
a.up = a.up / d;
a.down = a.down / d;
}
return a;
}
frac add(frac a, frac b){
frac res;
res.down = a.down * b.down;
res.up = a.up*b.down + b.up*a.down;
return reduc(res);
}
int main() {
int n;
scanf("%d", &n);
frac res,cur;
res.up=0;
res.down=1;
for(int i = 0;i < n; i++){
scanf("%lld/%lld", &cur.up, &cur.down);
res = add(res, cur);
}
if(res.down == 1){
printf("%lld\n",res.up);
}else{
if(res.up > res.down){
printf("%lld %lld/%lld\n",res.up / res.down, res.up % res.down, res.down);
}else{
printf("%lld/%lld\n", res.up, res.down);
}
}
return 0;
}