Start: Jun, 26, 2019 08:30:00
2019年度暑期短学期第一天
End: Jun, 26, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 211ms
Memory: 26464kB
Author: 2017212304046
In contest: 1273

from fractions import Fraction
n=int(input())
a=input().split()
u=0
for i in range(n):
    s=a[i]
    s=s.split('/')
    u=u+Fraction(int(s[0]),int(s[1]))
k=int(u)
m=u-k
if k==0 and m!=0:
    print(m)
elif k!=0 and m==0:
    print(k)
elif m!=0 and k!=0:
    print(k,end=' ')
    if k<0:
        print(-m)
    else:
        print(m)
else:
    print("0")