def gcd(a,b):
  while b:a,b=b,a%b
  return a
def xy(x,y):
  x,y=abs(x),abs(y)
  g=gcd(x,y)
  x//=g
  y//=g
  return (10**20)*x+y
from collections import defaultdict
mod=10**9+7
n=int(input())
aabb=[list(map(int,input().split()))for _ in range(n)]
ab=[]
for i in aabb:
  if i!=[0,0]:ab.append(i)
  else:n-=1
az=bz=0
d=defaultdict(int)
dd=defaultdict(int)
for i in ab:
  if 0 in i:
    if i[0]==0:az+=1
    else:bz+=1
  else:
    a,b=i
    if a*b>0:d[xy(a,b)]+=1
    else:dd[xy(a,b)]+=1
ans=pow(2,n,mod)-1
ans-=az*bz
t=[]
tt=0
for i in dd:
  b,a=divmod(i,10**20)
  p,m=d[xy(a,b)],dd[i]
  if p*m:
    t.append((p,m))
    n-=p+m
    tt+=(p+m+1)
for p,m in t:
  ttt=tt-(p+m)
  ans-=pow(2,n,mod)*ttt*(pow(2,p,mod)-1)*(pow(2,m,mod)-1)%mod
print(ans%mod)