from fractions import Fraction
from collections import defaultdict


def inverse(key):
    if key == "inf":
        return Fraction(0, 1)

    if key == Fraction(0, 1):
        return "inf"

    return - Fraction(key.denominator, key.numerator)


mod = 10 ** 9 + 7
n = int(input())
fishes = defaultdict(int)

zero_zero = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero_zero += 1
        continue

    elif b == 0:
        key = "inf"

    else:
        key = Fraction(a, b)

    fishes[key] += 1

ans = 1
counted_key = set()
for fish_key, count in fishes.items():
    if fish_key in counted_key:
        continue

    bad_pair = inverse(fish_key)
    if bad_pair in fishes:
        pair_count = fishes[bad_pair]
        pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
        counted_key.add(bad_pair)

    else:
        pattern = pow(2, count, mod)

    ans = ans * pattern % mod

if zero_zero:
    ans += zero_zero

ans -= 1
print(ans % mod)
