from fractions import Fraction
from collections import Counter

mod = 1000000007

n = int(input())
b_a = [None] * n
zeros = 0
for i in range(n):
    a, b = map(int, input().split())
    try:
        b_a[i] = Fraction(b, a)
    except ZeroDivisionError:
        b_a[i] = "INF"

b_a_counter = Counter(b_a)
counted = set()
ans = 1
for s, s_count in b_a_counter.items():
    if s not in counted:
        if type(s) == str:
            t = Fraction(0, 1)
        elif type(s) == Fraction:
            try:
                t = Fraction(-s.denominator, s.numerator)
            except ZeroDivisionError:
                t = "INF"
        t_count = b_a_counter[t]
        now = pow(2, s_count, mod)-1
        now += pow(2, t_count, mod)-1
        now += 1
        ans *= now
        counted.add(s)
        counted.add(t)
print(ans-1)
