n = int(input())
ablist = []
for i in range(n):
  ablist.append(list(map(int, input().split(" "))))

dp = [[0]*n]*n
for i in range(n-1):
  for j in range(i,n):
    if ablist[i][0]*ablist[i][1] + ablist[j][0]*ablist[j][1] == 0:
      dp[i][j] = 1
      dp[i][j] = 1

count = 0
for i in range(n):
  m=dp[i][i+1:n].count(0)
  count += 2**m

print(count%1000000007)