from collections import defaultdict
from math import gcd
N = int(input())
MOD = 10**9 + 7
L = defaultdict(lambda: [0,0])
for _ in range(N):
    A, B = map(int, input().split())
    d = gcd(A,B)
    A, B = A//d, B//d
    if A<0:
        A, B = -A, -B
    if B>=0:
        L[(A,B)][0] += 1
    else:
        L[(-B,A)][1] += 1
res = 1
for x,y in L.values():
    res *= pow(2,x,MOD) + pow(2,y,MOD) -1
    res %= MOD
print(res-1)