import math

N=int(input())

# xy = [map(int, input().split()) for _ in range(5)]
# A, B = [list(i) for i in zip(*xy)]

f=[]
for i in range(N):
    A, B =map(int,input().split())
    if A==0 and B==0:
        pass
    elif B==0:
        f.append([-1,0])
    elif B>0:
        f.append([int(A/math.gcd(A,B)),int(B/math.gcd(A,B))])
    else:
        f.append([int(-A/math.gcd(A,B)),int(-B/math.gcd(A,B))])

d=[]
ans=1
for i in range(N):
    same=1
    cros=0
    if f[i] != None:
        for j in range(i+1,N):
            if f[j]==None:
                pass
            elif f[i]==f[j]:
                same+=1
                f[j]=None
            elif f[i][0]==f[j][1] and f[i][1]==-f[j][0]:
                cros+=1
                f[j]=None
            elif f[i][0]==-f[j][1] and f[i][1]==f[j][0]:
                cros+=1
                f[j]=None            
        d.append([same,cros]) 
        if cros==0:
            ans*=(2**same)
        else:
            ans*=(2**same+2*cros)
            
        # d.append(same)
        # d.append(cros)
# ans=1
mod=1000000007
  
# for i in range(len(d)):
#     ans*=(2**d[i][0]+2**d[i][1])

print((ans-1)%mod)    