import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

mod = 10**9 + 7
def gcd(x, y):
    x = abs(x); y = abs(y)
    while y:
        x, y = y, x%y
    return x

azr = bzr = czr = 0
n = ni()
d = dict()
for _ in range(n):
    a, b = nm()
    if a < 0:
        a = -a
        b = -b
    if a == b == 0:
        czr += 1
    elif a == 0 :
        azr += 1
    elif b == 0:
        bzr += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
    if (a, b) not in d:
        d[(a, b)] = 0
    d[(a, b)] += 1

ans = (pow(2, azr, mod) + pow(2, bzr, mod) - 1) % mod
for x, y in d.items():
    if d[x] == 0:
        continue
    p, q = x
    if q < 0:
        q = -q
        p = -p
    if (q, -p) in d:
        z = d[(q, -p)]
        ans = ans * (pow(2, y, mod) + pow(2, z, mod) - 1) % mod
        d[x] = d[(q, -p)] = 0
    else:
        ans = ans * pow(2, y, mod) % mod
        d[x] = 0
ans = (ans - 1 + czr) % mod
print(ans)
