n=int(input())
dic={}
sus_a=0
sus_b=0
for i in range(n):
  a,b=map(int,input().split())
  if a==0 and b==0:
    continue
  elif a==0:
    sus_a+=1
    continue
  elif b==0:
    sus_b+=1
    continue
  x=a*1.0/b
  if x in dic.keys():
    dic[x] += 1
  else:
    dic[x] = 1
ans=1
for k,v in dic.items():
  if v==0:
    continue
  if -1.0/k not in dic:
    ans *= 2
  else:
    ans *= (2**v+2**(dic[-1.0/k])-1)
    dic[-1.0/k]=0

if sus_a * sus_b >0:
  ans *= (2**sus_a + 2**sus_b-1)
elif sus_a >0:
  ans *= 2**sus_a
elif sus_b>0:
  ans *= 2**sus_b
print((ans-1) % 1000000007)
