from math import gcd
from numpy import sign
mod = 1000000007
N = int(input())

if N == 1:
    print(1)
    
d = {}


for _ in range(N):
    a, b = list(map(int, input().split()))
    if a == b == 0:
        if (0, 0) not in d:
            d[(0, 0)] = 1
        else:
            d[(0, 0)] += 1
    else:
        g = gcd(a, b)
        a, b =  a / g, b /g
        if b < 0:
            a, b = -a, -b
        if b == 0:
            a, b =  1, 0
        if (a, b) not in d:
            d[(a, b)] =1
        else:
            d[(a, b)] +=1

answer = 1

done_list = []


for k in list(d.keys()):
    if k not in done_list and k != (0, 0):
        pair_k = (sign(k[0]) * (-1) * k[1], abs(k[0]))
        if pair_k not in d:
            answer *= (2 ** d[k]) % mod
            answer = answer % mod
            done_list += [k]
        else:
            answer *= ((2 ** d[k]) + (2 ** d[pair_k]) - 1) % mod
            answer = answer % mod
            done_list += [k, pair_k]

if (0, 0) in d:
    answer += d[(0, 0)]
    
print((answer - 1) % mod)