N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]

MOD = 1000000007
from collections import defaultdict
dd = defaultdict(int,{})
for a,b in AB:
  dd[-b/a] += 1
  
ans = 0
N -= 1
for a,b in AB:
  if N - dd[a/b]>=0:
    print(N-dd[a/b])
    ans += pow(2,(N - dd[a/b]),MOD)
    ans %= MOD
  dd[-b/a] -= 1
  N -= 1
  
print(ans%MOD) 