import math


n = int(input())
mod = 1000000007
ab = [list(map(int,input().split())) for _ in range(n)]
dic = {}
z = 0
for a,b in ab:
    if a == 0 and b == 0:
        z += 1
        continue
    if a< 0:
        a = -a
        b = -b
    g = math.gcd(a,b)
    tp = (a//g,b//g)
    if tp not in dic:
        dic[tp] = 1
    else:
        dic[tp] += 1
    
ans = 1
nn = n
for tp,v in dic.items():
    vt = (tp[1],-1*tp[0])
    if vt in dic:
        w = dic[vt]
        #print(tp)
        e = pow(2,v,mod) + pow(2,w,mod) - 1
        ans *= e
        ans %= mod
        nn -= v + w 
ans *= pow(2,nn,mod)
ans += z-1
print(ans%mod)
#print(dic)
