#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = {1, 0, -1, 0}, dj[4] = {0, 1, 0, -1};
int main(void) {
  int n, i, x, y;
  double a, b;
  map<double, int> sd;
  map<double, bool> u;
  long long ans, bi[200003] = {}, ks, lh;
  x = y = 0;
  lh = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%lf%lf", &a, &b);
    if (a * b == 0.0) {
      if (a == 0 && b == 0)
        lh++;
      else if (a == 0)
        y++;
      else if (b == 0)
        x++;
    } else {
      sd[a / b]++;
      sd[-b / a] += 0;
    }
  }
  bi[0] = 1;
  for (i = 1; i <= n; i++) {
    bi[i] = bi[i - 1] * 2 % mod;
  }
  ans = (bi[x] + bi[y] - 1) % mod;
  for (auto& mp : sd) {
    if (u[mp.first]) {
      continue;
    }
    u[mp.first] = true;
    u[-1 / mp.first] = true;
    ks = (bi[mp.second] + bi[sd[-1 / mp.first]] - 1) % mod;
    ans = ans * ks % mod;
  }
  ans = (ans + lh + mod - 1) % mod;
  printf("%lld\n", ans);
  return 0;
}
