n=int(input())
d={}
ex=0
for i in range(n):
    a,b=map(int,input().split())
    if a==0 and b==0:
        ex+=1
    elif a==0:
        if 0 not in d:
            d[0]=[1,0]
        else:
            d[0][0]+=1
    elif b==0:
        if 0 not in d:
            d[0]=[0,1]
        else:
            d[0][1]+=1
    else:
        if a/b not in d and -b/a not in d:
            d[a/b]=[1,0]
        elif a/b in d:
            d[a/b][0]+=1
        else:
            d[-b/a][1]+=1
sq=[1]*(n+1)
for i in range(n):
    sq[i+1]=2*sq[i]%1000000007

ans=1
r=list(d.values())
for i in range(len(r)):
    ans*=(sq[r[i][0]]+sq[r[i][1]]-1)%1000000007
print(ans+ex-1)