n=int(input())
dic={}
for i in range(n):
  a,b=map(int,input().split())
  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
  
print((ans-1) % 1000000007)