mod = 10**9+7
n = int(input())
fish = {}
rish = {}
att = 0
for _ in range(n):
  a,b = map(int,input().split())
  if a*b != 0:
    try:
      fish[a/b] += 1
    except:
      fish[a/b] = 1
    rish[-b/a] = 1
  elif a == 0 and b == 0:
    att += 1
  elif a == 0:
    try:
      fish[0] = 1
    except:
      fish[0] = 1
    rish[10**20] = 1
  else:
    try:
      fish[10**20] = 1
    except:
      fish[10**20] = 1
    rish[0] = 1
#print(fish)
#print(rish)
double = [1]
for _ in range(3*10**5):
  double.append(double[-1]*2%mod)
ans = 1
for x in fish:
  if not fish[x]:
    #print('#',x)
    continue
  if x in rish:
    ans *= double[fish[x]] + double[fish[-1/x]] - 1
    ans %= mod
    fish[x] = 0
    fish[-1/x] = 0
  else:
    ans *= double[fish[x]]
    ans %= mod
  #print(ans)
ans = ans-1+att
ans %= mod
print(ans)