from collections import defaultdict
from math import gcd

N = int(input())
MOD = 1000000007
d = defaultdict(int)
num_00 = 0
pow2 = [1]
for i in range(N):
  pow2.append((pow2[-1] * 2) % MOD)

def to_idx(a, b):
  if a == 0 and b != 0:
    return ((-1, 0), (1, 0))
  elif a != 0 and b == 0:
    return ((0, -1), (0, 1))
  else:
    return tuple(sorted(((a, b), (-a, -b))))

ans = 0
for i in range(N):
  a, b = map(int, input().split())
  if a == 0 and b != 0:
    d[((0, -1), (0, 1))] += 1
  elif a != 0 and b == 0:
    d[((-1, 0), (1, 0))] += 1
  elif a == b == 0:
    num_00 += 1
  else:
    g = gcd(a, b)
    a //= g; b //= g
    d[to_idx(a, b)] += 1

memo = []
key_set = set(d.keys())
while key_set:
  k = key_set.pop()
  v1, v2 = k
  a, b = v1
  idx = to_idx(-b, a)
  memo.append((pow2[d[k]] + pow2[d[idx]] - 1) % MOD)
  key_set.discard(idx)

ans = 1
for m in memo:
  ans *= m
  ans %= MOD

print((ans - 1 + num_00) % MOD)