import numpy as np
from collections import Counter

mod = 10**9 + 7

N = int(input())

A = np.array([0] * N)
B = np.array([0] * N)

for i in range(N):
    A[i], B[i] = map(int, input().split())

A_B = A / B
c_ab = Counter(A_B)
keys = list(c_ab.keys())
found = [False] * len(keys)

ans = 1

ans = ans * pow(2,(c_ab[0] + c_ab[np.inf]), mod) 

for i in range(len(keys)):
    if keys[i] == 0 or keys[i] == np.inf:
        found[i] == True

    for j in range(i+1, len(keys)):
        if keys[i] * keys[j] == -1:
            found[i], found[j] = True, True
            tmp = pow(2, c_ab[keys[i]], mod) + pow(2, c_ab[keys[j]], mod) - 1
            ans = ans * tmp % mod

r = 0
for i in range(len(keys)):
    if not found[i]:
        r += c_ab[keys[i]]

ans = ans * pow(2,r,mod) % mod - 1

print(ans)

