import bisect
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
mod = 1000000007
x = []
y = []
ex = [0,0]
ex2 = 0
for i in range(n):
    if (a[i][0]==0 and a[i][1]==0):
        ex2 += 1
    elif (a[i][0]==0):
        ex[0] +=1
    elif (a[i][1]==0):
        ex[1] += 1
    elif (a[i][0]*a[i][1]>0):
        x.append(a[i][1]/a[i][0])
    else:
        y.append(-a[i][0]/a[i][1])
     
x.sort()
y.sort()
#print(x,y)
xl = 0
yl = 0
xu = []
yu = []
xn = 0
yn = 0
while (xl<len(x) and yl<len(y)):
    if (x[xl] > y[yl]):
        yl += 1
    elif (x[xl] < y[yl]):
        xl += 1
    else:
        #print(xl,yl,x,y)
        p = bisect.bisect_right(x,x[xl])
        q = bisect.bisect_right(y,y[yl])
        xn += (p-xl)
        yn += (q-yl)
        xu.append(p-xl)
        yu.append(q-yl)
        xl = p
        yl = q
xn += ex[0]
yn += ex[1]
xu.append(ex[0])
yu.append(ex[1])
#print(xn,yn,xu,yu)
ans = pow(2,n-xn-yn-ex2,mod)
#print(ans)
#if (n-xn-yn>0):
    #t = 1
    #for i in range(1,n-xn-yn+1):
        #t *= i
        #t %= mod
    #ans += t
for i in range(len(xu)):
    ans *= (pow(2,xu[i],mod)+pow(2,yu[i],mod)-1)
    ans %= mod
if (n-xn-yn-ex2==0):
    print(ans)
elif (ex2==0):
    print((ans-1)%mod)
else:
    print((ans-1+ex2)%mod)
    
