import fractions
from collections import Counter
N = int(input())
A_B = []
mod = 1000000007
for _ in range(N):
    A, B = map(int, input().split())
    if A < 0:
        A = -A
        B = -B
    C = fractions.gcd(abs(A), abs(B))
    A_B.append((A//C, B//C))
A_B_C = Counter(A_B)


hate_couple = 0
ans = 1
Done = set([])
for key, value in A_B_C.items():
    if key in Done:
        continue
    keya, keyb = key
    a = 0
    if keyb < 0:
        keya = -keya
        keyb = -keyb
    if (keyb, -keya) not in A_B_C:
        a = pow(2, value, mod)
    else:
        a = (pow(2, value, mod) - 1) + (pow(2, A_B_C[(keyb, -keya)], mod) - 1) + 1
        Done.add((keyb, -keya))
    ans *= a
    Done.add(key)

print(ans - 1)