import math
import itertools

n = int(input())
mod = 1000000007

def Is_Positive(n):
    return n > 0

allZeros = 0
vectors = dict()
for i in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        allZeros += 1
        continue
    gcd = math.gcd(a, b)



    key = (0, 0)
    if Is_Positive(a) and Is_Positive(b):
        key = (abs(a) // gcd, abs(b) // gcd)
        if key not in vectors:
            vectors[key] = (1, 0)
        else:
            vectors[key] = (vectors[key][0] + 1, vectors[key][1])
    else:
        key = (abs(b) // gcd, abs(a) // gcd)
        if key not in vectors:
            vectors[key] = (0, 1)
        else:
            vectors[key] = (vectors[key][0], vectors[key][1] + 1)



total = 1
for vec in vectors.values():

    total *= (1 + (2**(vec[0])-1)
              + (2**(vec[1])-1)) % mod

print(total- 1 + allZeros)