N = int(input())
MOD = 1000000007
s, AB0, A0, B0 = {}, 0, 0, 0

for _ in range(N):
    A, B = map(int, input().split())
    if A == 0 and B == 0:
        AB0 += 1
    elif A == 0:
        A0 += 1
    elif B == 0:
        B0 += 1
    else:
        if s.get(A/B) == None:
            s[A/B] = 1
        else:
            s[A/B] += 1

f, ans = 0, 1
while len(s) > 0:
    k1, v1 = s.popitem()
    key = -1/k1
    if key in s.keys():
        v2 = s.pop(key)
        Cv1, Cv2 = pow(2, v1, MOD), pow(2, v2, MOD)     # pow(2, n, MOD) は二項定理による組み合わせの総和
        C = ((Cv1 + Cv2) % MOD + (MOD - 1)) % MOD
        ans = (ans * C) % MOD
    else:
        f += v1

if A0 == 0 or B0 == 0:
    f += A0 + B0
else:
    Cv1, Cv2 = pow(2, A0, MOD), pow(2, B0, MOD)     # pow(2, n, MOD) は二項定理による組み合わせの総和
    C = ((Cv1 + Cv2) % MOD + (MOD - 1)) % MOD
    ans = (ans * C) % MOD

ans = ((ans * pow(2, f, MOD)) % MOD  + (MOD - 1)) % MOD
ans = (ans + AB0) % MOD
print(ans)