from collections import defaultdict

MOD = (10 ** 9) + 7

def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

n = int(raw_input())

ns = []
d = defaultdict(int)

for i in xrange(n):
    a, b = map(int, raw_input().split())
    s = 1 if a * b >= 0 else -1
    g = gcd(abs(a), abs(b))

    m1 = (s * abs(a) / g, abs(b) / g)
    m2 = (-s * abs(b) / g, abs(a) / g)
    d[m1] += 1
    d[m2] += 0

pre = 1
for k in d.keys():
    if k[0] < 0:
        continue
    elif k[0] == 0:
        pre = pre * d[k] % MOD
    else:
        k1 = k
        k2 = (-k[1], k[0])

        tot = pow(2, d[k1], MOD) + pow(2, d[k2], MOD) - 1
        pre = pre * tot % MOD
print (pre - 1 + MOD) % MOD
