def modpow(a, n, p):
  if n <= 0:
    return 1
  if n == 1:
    return a % p 
  elif n % 2 == 1:
    return a * modpow(a, n-1, p) % p
  else:
    return modpow(a, n//2, p) **2 % p
MOD = 1000000007
n = int(input())
dct1 = {}
dct2 = {}
l = []
for i in range(n):
  a, b = map(int, input().split())
  l.append((a, b))
  if a == 0:
    dct1["a0"] = dct1.get("a0", 0) + 1
  elif b == 0:
    dct1["b0"] = dct1.get("b0", 0) + 1
  else:
    dct1[a/b] = dct1.get(a/b, 0) + 1
    dct2[-b/a] = dct2.get(-b/a, 0) + 1

count = 0
for i in range(n):
  a, b = l[i]
  l.append((a, b))
  if a == 0:
    count += modpow(2, n-1-i-dct1.get("b0",0), MOD)
  elif b == 0:
    count += modpow(2, n-1-i-dct1.get("a0",0), MOD)
  else:
    count += modpow(2, n-1-i-dct2.get(a/b, 0), MOD)
print(count % MOD)
    
  
