N = int(input())
MOD = 1000000007
s = {}

for _ in range(N):
    A, B = map(int, input().split())
    if B == 0:
        key = float('inf')
    else:
        key = A/B
    if s.get(key) == None:
        s[key] = 1
    else:
        s[key] += 1

f, ans = 0, 1
while len(s) > 0:
    k1, v1 = s.popitem()
    if k1 == 0:
        key = float('inf')
    else:
        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

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