import numpy as np

mod = 10 ** 9 + 7


def regularize(a, b):
    if a < 0 or (a == 0 and b < 0):
        a, b = -a, -b
    if b > 0:
        return 0, a, b
    else:
        return 1, -b, a


n = int(input())
edict = dict()
zero_num = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero_num += 1
        continue
    abgcd = np.gcd(a, b)
    a, b = a // abgcd, b // abgcd
    index, a, b = regularize(a, b)
    key = (a, b)
    if key not in edict.keys():
        edict[key] = [0, 0]
    edict[key][index] += 1
if len(edict.keys()) == 0:
    not_zeros = 0
else:
    not_zeros = 1
    for key in edict.keys():
        a, b = key
        pp, pm = edict[key]
        not_zeros *= (pow(2, pp, mod) + pow(2, pm, mod) - 1) % mod
        not_zeros %= mod
print((zero_num + not_zeros - 1) % mod)
