import math
from collections import defaultdict

def INP(): return int(input())
def LINP(): return list(map(int,input().split()))

MOD = 10 ** 9 + 7
d = defaultdict(int)
zero = 0
N = INP()
for _ in range(N):
    A,B = LINP()
    if A == 0 and B == 0:
        zero += 1
        continue
    A = int(A/math.gcd(A,B))
    B = int(B/math.gcd(A,B))
    minus = (-1) ** ((A < 0) + (B < 0))
    d[(minus * abs(A), abs(B))] += 1
print(d)
ans = 1
seen = set()
for a, b in d:
    if (a, b) not in seen:
        if(a, b) in [(0, 1), (1, 0)]:
            ainv, binv = b, a
        else:
            ainv, binv = b * (1 if a < 0 else -1), abs(a)
        new_ans = (2 ** d[(a, b)] - 1)
        new_ans += (2 ** d[(ainv, binv)] -1) if d.get((ainv, binv)) is not None else 0
        new_ans += 1
        ans = ans * new_ans % MOD
        seen.add((a, b))
        seen.add((ainv, binv))
ans = (ans + zero) & MOD
print((ans + MOD -1) % MOD)