import math, collections
N = int(input())
AB = [[int(_) for _ in input().split()] for _ in range(N)]
mod = 10**9 + 7
Cp = collections.Counter()
Cm = collections.Counter()
gcd = math.gcd
for a, b in AB:
    g = gcd(a, b)
    if g == 0:
        continue
    elif g > 1:
        a //= g
        b //= g
    if a < 0:
        a *= -1
        b *= -1
    if (a, b) == (0, -1):
        b = 1
    if b > 0:
        Cp[a, b] += 1
    else:
        Cm[a, b] += 1
ans = 1
for a, b in Cp:
    if (b, -a) in Cm:
        ans *= pow(2, Cp[a, b], mod) + pow(2, Cm[b, -a], mod) - 1
        ans %= mod
    else:
        ans *= pow(2, Cp[a, b], mod)
        ans %= mod
for a, b in Cm:
    if (-b, a) in Cp:
        continue
    else:
        ans *= pow(2, Cm[a, b], mod)
        ans %= mod
ans -= 1
print(ans)
