from fractions import Fraction

PRIME = 1000000007
n = int(input())

fish = {}
taste_0 = 0
flavor_0 = 0

for i in range(n):
  a, b = map(int, input().split())
  if a != 0 and b != 0:
    if Fraction(a, b) in fish:
      fish[Fraction(a, b)] += 1
    else:
      fish[Fraction(a, b)] = 1
  elif a == 0:
    taste_0 += 1
  else:
    flavor_0 += 1

ans = pow(2, taste_0, PRIME)
ans += pow(2, flavor_0, PRIME) - 1
ans %= PRIME

cnt = 0
for f in fish:
  inverse_f = Fraction(-f.denominator, f.numerator)
  if inverse_f in fish and fish[f] > 0:
    ans1 = pow(2, fish[f], PRIME)
    ans1 += pow(2, fish[inverse_f], PRIME) - 1
    ans *= ans1
    ans %= PRIME
    fish[f] = 0
    fish[inverse_f] = 0
  elif inverse_f not in fish:
    cnt += fish[f]

ans *= pow(2, cnt, PRIME)
ans %= PRIME

ans += PRIME - 1
ans %= PRIME

print(ans)