from fractions import Fraction as fra
P=10**9+7

n=int(input())
G=[]
for index1 in range(n):
    a,b=map(int,input().split())
    if a<0 and b>0:
        G.append((-a,-b))
    elif a<0 and b<0:
        G.append((-a,-b))
    else:
        G.append((a,b))

D={}
S=set()
for i in range(n):
    x=G[i][0]
    y=G[i][1]
    if x==0:
        if y==0:
            if 'XY' in S:
                D['XY'][2]+=1
                continue
            else:
                D['XY']=[0,0,1]
                S.add('XY')
                continue
        else:
            if 'XY' in S:
                D['XY'][0]+=1
                continue
            else:
                D['XY']=[1,0,0]
                S.add('XY')
                continue
    else:
        if y==0:
            if 'XY' in S:
                D['XY'][1]+=1
                continue
            else:
                D['XY']=[0,1,0]
                S.add('XY')
                continue

    temp=fra(x,y)
    if y>0:
        temp_over=fra(y,-x)
    else:
        temp_over=fra(-y,x)
    if temp in S:
        D[temp][0]+=1
    elif temp_over in S:
        D[temp_over][1]+=1
    else:
        D[temp]=[1,0]
        S.add(temp)



def culc(List):
    return (pow(2,List[0],P)+pow(2,List[1],P)-1)%P



ans=1
if 'XY' in S:
    X=D['XY'][0]
    Y=D['XY'][1]
    XY=D['XY'][2]

    


while S:
    now=S.pop()
    obj=D[now]
    ans=(ans*culc(obj))%P


ans=(ans*culc([X,Y]))%P
ans=(ans+XY)%P

print((ans-1)%P)






