def nasu(a, b):
  c = a / b
  return c  

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

MOD = 10 ** 9 + 7
R = {}

cnt = 0
ze = 0
for a, b in AB:
  if a == 0 and b == 0: 
    ze += 1
    continue
  if b == 0:
    s = "na"
  elif a == 0:
    s = "su"
  else:
    s = nasu(a, b)
  if s in R:
    R[s] += 1
  else:
    R[s] = 1
  cnt += 1

L = []
for i in R.keys():
  if i == "na":
    s = "su"
  elif i == "su":
    s = "na"
  else:
    s = - 1 / i
  t = R[i]
  if s not in R:
    L.append(pow(2, t, MOD))
    continue
  k = R[s]
  L.append((pow(2, t) + pow(2, k) - 1) % MOD)
  R[i] = 0
  R[s] = 0

ans = 1
for i in L:
  ans = ans * i % MOD

ans = (ans + ze) % MOD

ans -= 1
if ans < 0:
  ans += MOD
print(ans)


