import math
mod = 1000000007
D = {}
X = []
zero = 0
N = int(input())
for i in range(N):
    a,b = map(int,input().split())
    if (a,b) == (0,0):
        zero += 1
        continue
    if a < 0 :
        a = -a
        b = -b
    elif a == 0:
        b = 1
    g = math.gcd(a,b)
    a = a//g
    b = b//g
    c = b
    d = -a
    if c < 0:
        c = -c
        d = -d    
    if [a,b] in X:
        D[(a,b)] += 1
    else:
        D[(a,b)] = 1
        X.append([a,b])
n = N - zero
A = []
for [a,b] in X:
    c = b
    d = -a
    if c < 0:
        c = -c
        d = -d
    x = D[(a,b)]
    y = 0
    if [c,d] in X:
        y = D[(c,d)]
        X.remove([c,d])
    if y > 0:
        A.append([x,y])
        n = n - x - y
ans = 1
for [x,y] in A:
    z = (2**x + 2**y - 1)%mod
    ans *= z
    ans % mod
z = 2**n % mod
ans *= z
ans -= 1
ans % mod
ans += zero
print(ans)