import sys
from math import gcd
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.readline

N, *AB = map(int, read().split())
mod = 10 ** 9 + 7

ab = defaultdict(int)
zero = 0
for A, B in zip(*[iter(AB)] * 2):
    if A == 0 and B == 0:
        zero += 1
        continue
    if A == 0:
        B = -1
    elif B == 0:
        A = 1
    else:
        g = gcd(A, B)
        A //= g
        B //= g
    if A < 0:
        ab[(-A, -B)] += 1
    else:
        ab[(A, B)] += 1

answer = 1

for (i, j) in tuple(ab.keys()):
    n = ab[(i, j)]
    if j < 0:
        m = ab[(-j, i)]
    else:
        m = ab[(j, -i)]
    if m == -1:
        continue
    if m != 0:
        answer = (answer * (pow(2, n, mod) + pow(2, m, mod) - 1)) % mod
        ab[(i, j)] = -1
    else:
        answer = (answer * pow(2, n, mod)) % mod

answer -= 1
answer += zero
print(answer)
