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:
    if a == b == 0:
        continue
    elif a == 0:
        Cp[0, 1] += 1
    elif b == 0:
        Cm[-1, 0] += 1
    else:
        g = gcd(a, b)
        if g > 1:
            a //= g
            b //= g
        if a < 0:
            a *= -1
            b *= -1
        if b > 0:
            Cp[a, b] += 1
        else:
            Cm[a, b] += 1
ans = 1
for a, b in Cp:
    if Cm[b, -a] > 0:
        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 Cm[a, b] == 0 or Cp[-b, a] > 0:
        continue
    else:
        ans *= pow(2, Cm[a, b], mod)
        ans %= mod
ans -= 1
print(ans)
