N = int(input())
import numpy as np
ab=np.array([])
for i in range(N):
	A,B=map(float, input().split())
	ab=np.append(ab,[A,B])

a_all=ab[1::2]
b_all=ab[::2]
seki_all=a_all*b_all
a=a_all[seki_all!=0]
b=b_all[seki_all!=0]
frac_np=a/b

import collections
frac=frac_np.tolist()

fr_p=[i for i in frac if i>0]
fr_n=[-1.0/i for i in frac if i<0]
factors=set(fr_p+fr_n)
count_p=collections.Counter(fr_p)
count_n=collections.Counter(fr_n)

gamma=1
for i in factors:
	gamma*=(2**count_p[i]+2**count_n[i]-1)

print(gamma-1)

