from math import gcd
mod = 1000000007
n = int(input())

zerozero = 0
somezero = 0
zerosome = 0
plus = []
minus = []
for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zerozero += 1
    elif a == 0:
        zerosome += 1
    elif b == 0:
        somezero += 1
    elif (a > 0 and b > 0) or (a < 0 and b < 0):
        if a < 0:
            a, b = -a, -b
        g = gcd(a, b)
        a //= g
        b //= g
        plus.append((a, b))
    else:
        if a < 0:
            a = -a
        else:
            b = -b
        g = gcd(a, b)
        a //= g
        b //= g
        minus.append((b, a))

plus.sort()
minus.sort()

ans = pow(2, zerozero, mod)
ans *= pow(2, zerosome, mod) + pow(2, somezero, mod) - 1

i = 0
j = 0
while i < len(plus) and j < len(minus):
    ni = plus[i]
    nj = minus[j]
    if plus[i] < minus[j]:
        i += 1
        ans *= 2
        ans %= mod
        continue
    elif minus[j] < plus[i]:
        j += 1
        ans *= 2
        ans %= mod
        continue

    nump = 0
    numm = 0
    while i < len(plus) and plus[i] == ni:
        i += 1
        nump += 1
    while j < len(minus) and minus[j] == nj:
        j += 1
        numm += 1
    ans *= pow(2, nump, mod) + pow(2, numm, mod) - 1
    ans %= mod

ans *= pow(2, len(plus) - i, mod)
ans *= pow(2, len(minus) - j, mod)
ans %= mod

print(ans - 1)