from collections import defaultdict
from math import gcd

n = int(input())
L = []
for i in range(n):
    l = list(map(int, input().split()))
    L.append(l)

Mod = 10 ** 9 + 7

Pow2 = [1]
for i in range(n):
    Pow2.append(Pow2[-1]*2)

def kikaku(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a < 0:
        return - a, -b
    return a, b

Dpos = defaultdict(int)
Dneg = defaultdict(int)

c = 0
for l in L:
    a, b = kikaku(l[0], l[1])
    if a == b == 0:
        c += 1
    elif b > 0:
        Dpos[(b, -a)] += 1
        Dneg[(b, -a)] += 0
    else:
        Dpos[(a, b)] += 0
        Dneg[(a, b)] += 1

r = 1
for k, v in Dpos.items():
    j = Dneg[k]
    if v > 0 and j > 0:
        r = r * (Pow2[v] + Pow2[j] - 1) % Mod
#    elif v == 0 and j == 0:
#        pass
    else:
        r = r * 2 % Mod 
ans = (r + c - 1) % Mod
print(ans)