import math
n=int(input())
a=[None]*n
b=[None]*n
c=[None]*n
d=[None]*n
e=[None]*n
repeated=0
for i in range(n):
  a[i],b[i]=map(int,input().split())
  c[i]=a[i]/b[i]
  d[i]=-b[i]/a[i]
print(c)
for j in range(n-1,-1,-1):
  e[j]=c.count(d[j])+1
  c.pop()
total=(2**n-1) 
for k in range(n):
  if e[k]>0:
    total += -2**(n-e[k])*(2**(e[k]-1)-1) 
total += (2**(n-sum(e)))
#print(sum(e))
print(total % 1000000007 )

#print(d)
