import math


def modpow(val, n, mod):
    ret = 1
    while n:
        if n & 1:
            ret = (ret * val) % mod
        val = (val * val) % mod
        n = n >> 1
    return ret


n = int(input())
ab = []
for i in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))

my_dict = dict()

ab_mod = []
for item in ab:
    a, b = item
    if a == 0 and b == 0:
        ab_mod.append((0, 0))
    elif a == 0:
        ab_mod.append((0, 1))
    elif b == 0:
        ab_mod.append((1, 0))
    else:
        gcd = math.gcd(abs(a), abs(b))
        if a < 0:
            a = -a
            b = -b
        ab_mod.append((a // gcd, b // gcd))

for item in ab_mod:
    if item not in my_dict:
        my_dict[item] = 1
    else:
        my_dict[item] += 1


if (0, 0) in my_dict:
    num_dame = my_dict.pop((0, 0))
else:
    num_dame = 0

num_total = n - num_dame
dame_tuple = []

for item in my_dict:
    a, b = item
    val1 = my_dict[item]
    if (b, -a) in my_dict:
        val2 = my_dict[(b, -a)]
        dame_tuple.append((val1, val2))
        num_total -= (val1 + val2)

ret = 1

ret *= modpow(2, num_total, 10 ** 9 + 7)


for item in dame_tuple:
    val1, val2 = item
    zenbu = modpow(2, val1 + val2, 10 ** 9 + 7)
    dame1 = modpow(2, val1, 10 ** 9 + 7) - 1
    dame2 = modpow(2, val2, 10 ** 9 + 7) - 1
    ret *= (zenbu - (dame1 * dame2))

ret -= 1

print(ret % (10 ** 9 + 7))
