import math

def m(L):
    (a,b)=L
    g=math.gcd(a,b)
    
    if b==0:
        return (1,0)
    elif b>0:
        return (a//g,b//g)
    else:
        return (-a//g,-b//g)

def w(x,y):
    if x==0:
        return 2**y
    elif y==0:
        return 2**x
    else:
        return 2**x+2**y-1
    
N=int(input())
D=[]
for i in range(N):
    (A,B)=map(int,input().split())
    D.append((A,B))

O=0
for u in range(N):
    if D[u]==(0,0):
        D.remove((0,0))
        O=1
        
M=list(map(m,D))
    
J={}

for m in M:
    if m in J:
        J[m]+=1
    else:
        J[m]=1

K={}
for u in J:
    (a,b)=u
    p=J[u]
    
    if a>=0:
        (c,d)=(-b,a)
    else:
        (c,d)=(b,-a)

    f=True
    if (a,b) in K:
        (x,y)=K[(a,b)]
        if a>=0:
            x+=p
        else:
            y+=p
        K[(a,b)]=(x,y)
        f=False

    elif f and ((c,d) in K):
        (x,y)=K[(c,d)]
        if c<=0:
            x+=p
        else:
            y+=p
        K[(c,d)]=(x,y)
        f=False
        
    elif f:
        if a>=0:
            K[(a,b)]=(p,0)
        else:
            K[(a,b)]=(0,p)

G=[w(x,y) for (x,y) in K.values()]

r=1
V=1000000007

for g in G:
    r=(r*g)%V

print(r-1+O)

