import math
import itertools

n = int(input())

vectors = dict()
for i in range(n):
    a, b = map(int, input().split())
    gcd = math.gcd(a, b)

    key = (0, 0)
    if a * b < 0:
        key = (abs(b), abs(a))
    else:
        key = (abs(a), abs(b))

    if key not in vectors:
        vectors[key] = [i]
    else:
        vectors[key].append(i)

mod = 1000000007
# total = (pow(2, len(vectors)) - 1) % mod

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

total = 1
for vec in vectors.values():

    comb = (combinations_count(len(vec), 2) if len(vec) >= 2 else 0)
    total *= (2+comb) % mod

print(total- 1)