import sys
from collections import defaultdict
from math import gcd


def prepare(n, MOD):
    f = 1
    factorials = [1]
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    return factorials, invs


MOD = 10 ** 9 + 7
n, *ab = map(int, sys.stdin.buffer.read().split())
ab_zero = 0
a_zero = 0
b_zero = 0
nonzero = defaultdict(int)

for a, b in zip(ab[0::2], ab[1::2]):
    if a == 0 and b == 0:
        ab_zero += 1
    elif a == 0:
        a_zero += 1
    elif b == 0:
        b_zero += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0:
            a, b = -a, -b
        if a == 0 and b < 0:
            b = -b
        nonzero[a, b] += 1

n -= ab_zero

dame_pairs_pattern = 1
dame_pairs_cnt = 0

if a_zero > 0 and b_zero > 0:
    dame_pairs_pattern *= pow(2, a_zero, MOD) + pow(2, b_zero, MOD) - 1
    dame_pairs_cnt += a_zero + b_zero

checked = set()

for (a, b), cnt in nonzero.items():
    if (a, b) in checked:
        continue
    if b < 0:
        c, d = -b, a
    else:
        c, d = b, -a
    if (c, d) in nonzero:
        cnt2 = nonzero[c, d]
        dame_pairs_pattern *= pow(2, cnt, MOD) + pow(2, cnt2, MOD) - 1
        dame_pairs_pattern %= MOD
        dame_pairs_cnt += cnt + cnt2
        checked.add((c, d))

ans = dame_pairs_pattern * pow(2, n - dame_pairs_cnt, MOD) - 1

print(ans % MOD)
