import sys
input = sys.stdin.readline
from functools import cmp_to_key
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
mod = 10**9+7
n00 = 0
n0x = 0
nx0 = 0
nxy = 0
ls = []
for i in range(n):
  if a[i][0] == a[i][1] == 0:
    n00 += 1
  elif a[i][0] == 0:
    n0x += 1
  elif a[i][1] == 0:
    nx0 += 1
  else:
    nxy += 1
    if a[i][0] < 0 and a[i][1] < 0:
      a[i][0] *= -1
      a[i][1] *= -1
    elif a[i][0] < 0:
      a[i][0] *= -1
      a[i][1] *= -1
    ls.append(a[i])
def sorting(x,y):
  if x[0]*y[1]-x[1]*y[0] == 0:
    return 0
  if x[0]*y[1]-x[1]*y[0] > 0:
    return 1
  else:
    return -1
ls.sort(key = cmp_to_key(sorting))
tls = []
t = 1
for i in range(1,n):
  if sorting(ls[i],ls[i-1]) == 0:
    t += 1
  else:
    tls.append([t,*ls[i-1]])
    t = 1
tls.append([t,*ls[n-1]])
for i in range(len(tls)):
  if tls[i][2] < 0:
    tls = tls[:i]+tls[len(tls)-1:i-1:-1]
    break

l = 0
r = len(tls)-1
banned = []
while l < r:
  la,lb = tls[l][1:]
  ra,rb = tls[r][1:]
  if la*ra + lb*rb == 0:
    banned.append((tls[l][0],tls[r][0]))
    l += 1
    r -= 1
  elif la*ra + lb*rb > 0:
    r -= 1
  else:
    l += 1
sm = sum([banned[i][0]+banned[i][1] for i in range(len(banned))])
def p2(x):
  return pow(2,x,mod)
ans = p2(n-sm)
for i,j in banned:
  ans = (ans*(p2(i)+p2(j)-1))%mod
k = p2(n0x)+p2(nx0)-1
ans *= k
ans += n00-1
print(ans%mod)