import sys
from collections import Counter
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = Counter()
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for x, y in a:
  if (x, y) == (0, 0):
    z += 1
    continue
  if y < 0:
    x *= -1
    y *= -1
  if x == 0:
    x = 0
    y = 1
  elif y == 0:
    x = 1
    y = 0
  g = gcd(abs(x), abs(y))
  x //= g
  y //= g
  d[(x, y)] += 1

res = 1
itr = list(d.keys())
#print(itr, d)
for x, y in itr:
  t = 0
  #if x <= 0 and (d[(y, -x)] > 0): continue
  if (x, y) == (0, 1):
    t = d[(1, 0)]
    d[(1, 0)] = 0
  elif (x, y) == (1, 0):
    t = d[(0, 1)]
    d[(0, 1)] = 0
  else:
    t = d[(y * pow(-1, int(x < 0) + 1), abs(x))]
    d[(y * pow(-1, int(x < 0) + 1), abs(x))] = 0
  v = 0
  v += pow(2, d[(x, y)], mod) - 1
  v %= mod
  v += pow(2, t, mod) - 1
  v %= mod
  v += 1
  v %= mod
  res *= v
  res %= mod
  #print(res, d, d[(x, y)], t)
  d[(x, y)] = 0


#print(itr, u, res, z)
print(res - 1 + z % mod)