import math
mod = 10**9+7
n = int(input())
cnt = {}
cnt_zero = 0

for i in range(n):
  a, b = map(int, input().split())
  if (a, b) == (0, 0):
    cnt_zero += 1
    continue
    
  if b == 0:
    if not (0, 0) in cnt:
      cnt[(0, 0)] = [0, 1]
    cnt[(0, 0)][1] += 1
  if a == 0:
    if not (0, 0) in cnt:
      cnt[(0, 0)] = [1, 0]
    cnt[(0, 0)][0] += 1
  
  waruyatu = math.gcd(a, b)
  a //= waruyatu
  b //= waruyatu
  if a*b > 0:
    a, b = abs(a), abs(b)
    if not (a, b) in cnt:
      cnt[(a, b)] = [1, 0]
    else:
      cnt[(a, b)][0] += 1
  else:
    a, b = abs(a), abs(b)
    if not (b, a) in cnt:
      cnt[(b, a)] = [0, 1]
    else:
      cnt[(b, a)][1] += 1

ans = 1
for key in cnt:
  ans *= pow(2, cnt[key][0], mod) + pow(2, cnt[key][1], mod) - 1
  ans %= mod
ans += cnt_zero
ans -= 1
ans %= mod
print(ans)
  
  