n=int(input())
dp=[0]*n
dp[0]=1
p=10**9+7
a,b=map(int,input().split())
m=[[a,b]]
M=[0]*n
for i in range(n-2):
  a,b=map(int,input().split())
  for j in range(i+1,n-1):
    if a*m[j][0]+b*m[j][1]==0:
      M[i]+=1
      
for i in range(1,n):
  dp[i]=dp[i-1]+2**(i-M[i]-1)
  if p<=dp[i]:
    dp[i]=dp[i]%p
print(dp[n-1])