from math import gcd

n = int(input())
MOD = 10**9+7
p_map = {}
n_map = {}

z_map = 0
for _ in range(n):
    ab = list(map(int, input().split()))
    ab_gcd = gcd(ab[0], ab[1])
    if ab_gcd == 0:
        ab_gcd = 1
    a = ab[0]//ab_gcd
    b = ab[1]//ab_gcd

    key = "{}_{}".format(a, b)
    if a*b > 0:
        if key not in p_map:
            p_map[key] = 1
        else:
            p_map[key] += 1
    elif a == 0 and b == 0:
        z_map += 1
    else:
        if key not in n_map:
            n_map[key] = 1
        else:
            n_map[key] += 1

ans = 1
for k, v in p_map.items():

    a = int(k.split("_")[0])
    b = int(k.split("_")[1])
    n_num = 0
    key_a = "{}_{}".format(-b, a)
    key_b = "{}_{}".format(b, -a)
    if key_a in n_map:
        n_num += n_map.pop(key_a)
    if key_b in n_map:
        n_num += n_map.pop(key_b)
    res = 0
    res += pow(2, v, MOD)-1
    if n_num > 0:
        res += pow(2, n_num, MOD)-1
    res += 1
    ans *= res
    ans %= MOD

n_num = sum(n_map.values())
ans *= pow(2, n_num, MOD)
ans %= MOD

if z_map > 0:
    ans += z_map
ans %= MOD
ans -= 1
print(ans)