import collections
import math

N=int(input())
posi=[]
nega=[]
mod=1000000007
power=[1]*(N+1)
zero=0

for i in range(1,N+1):
    power[i]=power[i-1]*2%mod
    
for i in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        zero+=1
    elif a==0:
        posi.append((0,1))
    elif b==0:
        nega.append((1,0))
    elif a/b>=0:
        posi.append((a/math.gcd(a,b),b/math.gcd(a,b)))
    else:
        nega.append((abs(b/math.gcd(a,b)),abs(a/math.gcd(a,b))))

m=N-zero
cp=collections.Counter(posi)
cn=collections.Counter(nega)

x=1
y=1


for pp in cp.keys():
    if pp in cn.keys():
        p=cp[pp]
        n=cn[pp]
        powp=power[p]
        pown=power[n]
        e=(powp-1)*(pown-1)%mod
        f=(powp+pown-1)%mod
        x=x*(e+f)%mod
        y=y*f%mod
        m-=(p+n)
        
ans=power[N-zero]-1-power[m]*(x-y)%mod
print((ans+zero)%mod)    