n=int(input())
import fractions
def f(x,y):
    if x!=0:
        return fractions.Fraction(y,x)
    else:
        return 'inf'
def g(x):
    if x!=0 and x!='inf':
        return (-1)*fractions.Fraction(1,x)
    elif x==0:
        return 'inf'
    else:
        return 0
A=[1]*n #傾きの個数
B=[1]*n #傾きの対立の個数
C=[0]*n #傾きの値
D=[0]*n #傾きの対立の値
for i in range(n):
    a,b=map(int,input().split())
    t=f(a,b)
    if t in C:
        k=C.index(t)
        A[k]=A[k]*2%1000000007
    elif t in D:
        k=D.index(t)
        B[k]=B[k]*2%1000000007
    else:
        k=A.index(1)
        C[k]=t
        D[k]=g(t)
        A[k]=A[k]*2%1000000007
s=0
j=1
for i in range(n):
    s=(s+j*(A[i]+B[i]-2))%1000000007
    j=j*(A[i]+B[i]-1)%1000000007
print(s)    
        
        
         
        


