import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import defaultdict
P = 7 ** 21 + 52
mod = 10 ** 9 + 7
N = int(input())
D = defaultdict(int)
C00 = 0
C0 = 0
for i in range(N):
    a, b = map(int, input().split())
    if a == b == 0:
        C00 += 1
    elif a == 0 or b == 0:
        C0 += 1
    else:
        x = a * pow(b, P - 2, P) % P
        D[x] += 1
ans = C0 + 1
for x in D:
    y = pow(-x, P - 2, P)
    if y in D and x > y: continue
    ans *= 1 + pow(2, D[x], mod) - 1 + pow(2, (D[y] if y in D else 0), mod) - 1
    ans %= mod
print((ans + C00 - 1) % mod)