N=int(input())
C=[]
for i in range(N):
  A,B=list(map(int,input().split()))
  C.append(A/B)
count=0
for i in range(C):
  for j in range(i,C):
    if C[i]==1/C[j]:
      count+=1
      
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print((combinations_count(N, 2)-count)/1000000007)
