import math

n = int(input())
mod = 10**9+7
d = {}
l = []
s = set()
zero = 0
for i in range(n):
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        zero += 1
    elif a == 0:
        s1 = (0,1)
        s2 = (1,0)
    elif b == 0:
        s1 = (1,0)
        s2 = (0,1)
    else:
        
        g = math.gcd(a,b)
        if b > 0:
            a //= g
            b //= g
            s1 = (a,b)
            if a > 0:
                
                s2 = (-b,a)
            else: 
                
                s2 = (b,-a)
        else:
            a //= g
            b //= g
            s1 = (-a,-b)
            if a < 0:
                
                s2 = (b,-a)
            else:
                
                s2 = (-b,a)
    if s1 in d:
        d[s1] += 1
    else:
        d[s1] = 1
    if s1 in s:
        continue
    else:
        if s2 in d:
            l.append([s1,s2])
            s.add(s1)
            s.add(s2)
    
ans = 1
for a,b in l:
    count = (pow(2,d[a],mod)+pow(2,d[b],mod)-1)%mod
    ans *= count
    ans %= mod
for i,j in d.items():
    if i in s:
        continue
    else:
        ans *= pow(2,j,mod)
        ans %= mod

print(ans+zero-1)


