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)
for a,b in L:
    if a==0 and b==0:
        both_zero+=1
        continue
    
    if b==0:
        D["1.0:0.0"]+=1
        continue
    g=gcd(abs(a),abs(b))
    prefix="" if a*b>=0 else "-"
    key=prefix+str(abs(float(a/g)))+":"+str(abs(float(b/g)))
    D[key]+=1


ans=1
MOD=10**9+7

used_key=set()
for key,val in D.items():
    if key in used_key:
        continue
    if "-" in key:
        key=key[1:]
        rev_key=":".join(reversed(key.split(":")))
    else:
        rev_key="-"+":".join(reversed(key.split(":")))
    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*=(both_zero+1)
print((ans+MOD-1)%MOD)

