#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 110;
const int inf = 0x3f3f3f3f;
int n, m, x, y, k;
int a[maxn];
int gcd(int x, int y)
{
int m, n, z;
m = x, n = y;
while (y != 0)
{
z = x % y;
x = y;
y = z;
}
return m * n / x;
}
int gcd1(int x, int y)
{
int m, n, z;
m = x, n = y;
while (y != 0)
{
z = x % y;
x = y;
y = z;
}
return x;
}
int main()
{
while (scanf("%d", &n) != EOF)
{
int t;
scanf("%d/%d", &x, &y);
n--;
while (n--)
{
t = y;
scanf("%d/%d", &m, &k);
y = gcd(y, k);
x = (y / t)*x + (y / k)*m;
}
int ans1 = x / y;
x %= y;
if(x==0)
printf("%d\n", ans1);
else
{
t = gcd1(x, y);
if (ans1 != 0) {
printf("%d %d/%d\n",ans1,abs(x / t), abs(y / t));
}
else
printf("%d/%d\n", x / t, y / t);
}
}
return 0;
}