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]
    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
while S:
    now=S.pop()
    obj=D[now]
    ans=(ans*culc(obj))%P

print((ans-1)%P)



