import sys
input=sys.stdin.readline
n=int(input())
INF=10**9+7
D={}
z=0
import math
for i in range(n):
    a,b=map(int,input().split())
    if a==0:
        if b==0:
            z+=1
        else:
            if (0,1) in D:
                D[(0,1)]+=1
            else:
                D[(0,1)]=1
    elif b==0:
        if (1, 0) in D:
            D[(1,0)] += 1
        else:
            D[(1,0)] = 1
    else:
        if b<0:
            b=-b
            a=-a
        if a>0:
            c=math.gcd(a,b)
            a//=c
            b//=c
            if (a,b) in D:
                D[(a,b)] += 1
            else:
                D[(a,b)] = 1
        else:
            a=-a
            c = math.gcd(a, b)
            a //= c
            b //= c
            a=-a
            if (a, b) in D:
                D[(a, b)] += 1
            else:
                D[(a, b)] = 1
ans=1
p=[1]
for i in range(n):
    temp=(p[-1]*2)%INF
    p.append(temp)
for i in D:
    if not D[i]==0:
        x=i[0]
        y=i[1]
        if x>0:
            if (-y,x) in D:
                temp=D[(-y,x)]
                D[(-y,x)]=0
                ans=(ans*(p[D[i]]+p[temp]-1))%INF
            else:
                ans=ans*p[D[i]]%INF
        else:
            if (y,-x) in D:
                temp=D[(y,-x)]
                D[(y,-x)]=0
                ans=(ans*(p[D[i]]+p[temp]-1))%INF
            else:
                ans=ans*p[D[i]]%INF
if z==0:
    ans=(z+ans-1)%INF
else:
    ans=(ans-1)%INF
print(ans)

