from collections import defaultdict
import bisect

def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while b:
        a,b =b, a%b
    return a

N=int(input())
L = [list(map(int,input().split())) for _ in range(N)]


both_zero=0
D=defaultdict(int)
D01=0
D10=0
for a,b in L:
    if a==0 and b==0:
        both_zero+=1
        continue
    
    if b==0:
        D10+=1
        continue
    elif a==0:
        D01+=1
        continue
    g=gcd(abs(a),abs(b))
    prefix= 1 if a*b>=0 else -1
    D[(prefix*abs(a/g),abs(b/g))]+=1


ans=1
MOD=10**9+7

used_key=set()
for key,val in D.items():
    if key in used_key:
        continue
    if key[0]*key[1]<0:
        rev_key=(abs(key[1]),abs(key[0]))
    else:
        rev_key=(-abs(key[1]),abs(key[0]))
    if rev_key not in D.keys():
        ans*=pow(2,val,MOD)
        continue
    rev_val = D[rev_key]
    ans*=(((pow(2,val,MOD)-1)+(pow(2,rev_val,MOD))-1)+1)
    used_key.add(rev_key)
    used_key.add(key)

ans*=(((pow(2,D01,MOD)-1)+(pow(2,D10,MOD))-1)+1)
ans*=(both_zero+1)
print((ans+MOD-1)%MOD)

