
import math

def heikatu(A,B):

    
    c = math.gcd(A,B)

    return (A//c,B//c)
 
 
def pow_r(x, n,mod=10**9+7):
    """
    O(log n)
    """
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r((x ** 2)%1000000007 , n // 2) % mod
    else:  # standard case ② n is odd
        return (x * pow_r((x ** 2)%1000000007, (n - 1) // 2) % mod) % mod
 
 
 
def resolve():
    N = int(input())
 
    
    km = dict()
    zero = [0,0]
    zerozero = 0
    for i in range(N):
        A,B = map(int,input().split())
 
        if A == 0 and B == 0:
            zerozero+=1
            raise
            continue
 

 
        if A <0:
            A *= -1
            B *= -1
        xx = heikatu(A,B)
 
 
 

        if not xx in km:
            km[xx]=0
        km[xx]+=1
    ans = 1

    for x,y in sorted(km.keys(),key = lambda x: x[1]):

        if km[(x,y)]==0:

            continue
        tmp = pow_r(2,km[(x,y)])
        km[(x,y)] = 0
        rev = (-y,x)
        if rev in km and km[rev]!=0:

            tmp+=pow_r(2,km[rev])-1
            tmp %= 1000000007
            km[rev]=0

        ans *= tmp
        ans %= 1000000007




    print((ans+zerozero-1)%(10**9+7))       

resolve()
     