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())
 
    kp = dict()
    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
            continue
 
        if A == 0:
            zero[0]+=1
            continue
        if B == 0:
            zero[1]+=1
            continue
 
        if A <0:
            A *= -1
            B *= -1
        xx = heikatu(A,B)
 
 
 
        if B < 0:
            if not xx in km:
                km[xx]=0
            km[xx]+=1
        else:
            if not xx in kp:
                kp[xx]=0
            kp[xx]+=1
 
    tx = dict()
    if zero != [0,0]:
        zero.sort()
        tx[tuple(zero)] = 1
 
    for key in kp:
        A,B = key
        cou = kp[key]    
        if (B,-A) in km:
            tmp = (cou,km[(B,-A)])
            km.pop((B,-A))
        else:
            tmp = ((cou,0))
        
        tmp = tuple(sorted(tmp))
        if not tmp in tx:
            tx[tmp] = 0
        tx[tmp]+=1
 
    for key in km:
        if not (km[key],0) in tx:
            tx[(km[key],0)]=0    
        tx[(km[key],0)]+=1
 
    ans = 1
    mod = 1000000007
 
    for a,b in tx:
        xxx = 0
        if a != 0:
            xxx=(xxx+pow_r(2,a)) %mod
        if b != 0:
            xxx=(xxx+pow_r(2,b)) %mod
        if a !=0 and b!=0:
            xxx-=1
        xxx = pow_r(xxx,tx[(a,b)]) 
        ans = (ans*xxx) % mod
 
 
    ans = (ans+mod-1) % mod 
 
    print(ans)       

resolve()
