N = int(input())
MOD = 1000000007
d = {}
m = {}
for i in range(N):
  a, b = map(int, input().split())
  if -b/a in set(d.keys()):
    d[-b/a] += 1
  elif a/b in set(d.keys()):
    if a/b in set(m.keys()):
      m[a/b] += 1
    else:
      m[a/b] = 2      
  else:
    d[a/b] = 2
ans = 1
for v in d.values():
  ans = ans*v%MOD
for v in m.values():
  ans = ans+ans*(v-1)*0.5%MOD
print(ans-1)