n = int(input())
a = []
b = []
for _ in range(n):
  tmp = input().split()
  a.append(int(tmp[0]))
  b.append(int(tmp[1]))

counter = 0

for i in range(2 ** n):
  p_list = []
  m_list = []
  z_list = []
  j_list = []
  for j in range(n):
    if (i >> j) & 1:
      j_list.append(j)
      calc = a[j] * b[j]
      if calc > 0:
        p_list.append(calc)
      elif calc < 0:
        m_list.append(-1 * calc)
      else:
        z_list.append(calc)
  if j_list != [] and len(z_list) < 2 and len(set(p_list) & set(m_list)) == 0:
    counter += 1
    counter = counter % 1000000007

print(counter)
