
from itertools import permutations

def parse():
  N = int(input())
  A = []
  B = []
  for n in range(N):
    a, b = map(int, input().split(" "))
    A.append(a)
    B.append(b)
  return N, A, B

def main():
  N, A, B = parse()
  # print(N, A, B)

  # loop_limit = 100000
  ans = 0
  for l in range(pow(2, N)):
    # if i >= loop_limit: break

    pattern = [l % 2 == 0]
    for j in range(1, N):
      selected = int(l // pow(2, j)) % 2 == 0
      pattern.append(selected)
    pattern.reverse()

    # print(pattern)
    if sum(pattern) == 1:
      # print(pattern)
      ans += 1  # 1匹のみ選択の場合
    elif sum(pattern) == 0: pass  # 1匹も選ばなかった場合
    else:
      can_together = True
      skip = False
      for i, selected_i in enumerate(pattern):
        if selected_i:
          for j, selected_j in enumerate(pattern):
            if i == j: continue
            if selected_j:
              if A[i] * A[j] + B[i] * B[j] == 0:
                can_together = False
                break
          if not can_together:
            break
      if can_together: ans += 1
  
  print(ans % 1000000007)

if __name__ == "__main__":
  main()