from fractions import gcd

MOD = 1000000007


def pow2(e):
    res = 1
    b = 2
    while e:
        if e & 1:
            res = res * b % MOD
        e >>= 1
        b = b * b % MOD
    return res


N = int(input())
counts = {}
for _ in range(N):
    a, b = map(int, input().split())
    g = gcd(a, b)
    a /= g
    b /= g
    if b == 0 and a != 0:
        a = 1
    if a == 0 and b != 0:
        b = 1
    if a < 0:
        a *= -1
        b *= -1
    counts[(a, b)] = counts.get((a, b), 0) + 1

res = 1
while counts:
    (a, b), cnt = counts.popitem()
    c, d = -b, a
    if c < 0:
        c *= -1
        d *= -1
    cnt2 = counts.pop((c, d), 0)
    res = res * (pow2(cnt) + pow2(cnt2) - 1) % MOD
print((res - 1) % MOD)
