from math import gcd
from collections import Counter
mod = 10**9+7
def f(aai, bbi):
    if (aai == 0)&(bbi==0):
        return 0, 0
    gc = gcd(aai, bbi)
    a, b = aai // gc, bbi // gc
    if a < 0:
        a = -a
        b = -b
    return a, b

n= int(input())
aa = [0] * n
for i in range(n):
    ai, bi = map(int, input().split())
    aa[i] = f(ai, bi)

dic_ = Counter(aa)

cnt = 1
while len(dic_) > 0:
    k, v = dic_.popitem()
    ka , kb = k[0], k[1]
    if kb < 0:
        ka = -ka
        kb = -kb
    t = dic_.get((kb, -ka), 0)
    if t > 0:
        del dic_[(kb, -ka)]
        cnt *= ((2**v) + (2**t) - 1) % mod
    else:
        cnt *= (2**v) % mod
print((cnt+mod-1)%mod)        
