from collections import Counter
from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
ct = Counter()
Azero = 0
Bzero = 0
Allzero = 0
arr = set()
for _ in range(N):
    a, b = map(int, input().split())
    if a == b == 0:
        Allzero += 1
    elif a == 0:
        Azero += 1
    elif b == 0:
        Bzero += 1
    else:
        ct[a/b] += 1
        arr.add((a, b))
ans = 1 + Allzero
ans *= 1 + Azero + Bzero
visited = set()
for (a, b) in arr:
    v = a/b
    if v in visited:
        continue
    inv = -b/a
    visited.add(v)
    visited.add(inv)
    tmp = 1 + (pow(2, ct[v], MOD)-1) + (pow(2, ct[inv], MOD)-1)
    ans *= tmp
    ans %= MOD
print(ans-1)
