n = int(input())
import collections
number_list = []
f = 0
for i in range(n):
  a, b = map(int, input().split())
  if a!=0 and b!= 0:
    number_list.append(a/b)
  elif a == 0 and b == 0:
    f += 1
  else:
    number_list.append(0)
c = collections.Counter(number_list)
keys = c.keys()
number = c.values()
ans_list = []
num = 0
z = []
for i in keys:
  if i < 0:
    if (-1)/i in keys:
      x = c[i]
      y = c[(-1)/i]
      ans_list.append(2**(x + y) - (2**x - 1)*(2**y - 1))
      num += x + y
if c[0] >= 2:
  num += c[0]
ans =2**(n - num - f)
if c[0] >= 2:
  ans = ans*(c[0] + 1)
for i in ans_list:
  ans *= i
ans -= 1 
ans += f
ans %= 1000000007
print(ans)