#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long MODPOW2[200002] = {0};
void initModPow2() {
  MODPOW2[0] = 1;
  for (int i = 1; i < 200002; i++) {
    MODPOW2[i] = (MODPOW2[i - 1] * 2) % MOD;
  }
}
long long countUV(long long u, long long v) {
  long long a = 0, b = 0, c = 0, ret = 0;
  a = MODPOW2[u + v] % MOD;
  b = (MODPOW2[u] - 1) % MOD;
  b = (b * (MODPOW2[v] - 1)) % MOD;
  ret = (a - b) % MOD;
  if (ret < 0) ret += MOD;
  return ret;
}
class Tilt {
 public:
  long long x;
  long long y;
  Tilt(long long x, long long y) { this->x = x, this->y = y; }
  inline bool operator==(const Tilt& t) const {
    if (this->x * t.y - this->y * t.x == 0) {
      return true;
    } else {
      return false;
    }
  }
  inline bool operator!=(const Tilt& t) const { return !(this->operator==(t)); }
};
class MyHash {
 public:
  std::size_t operator()(const Tilt& t) const {
    if (t.y == 0) {
      return (std::size_t)MOD;
    } else {
      long long r = t.x / t.y;
      r = r % MOD;
      return (std::size_t)r;
    }
  }
};
vector<Tilt> T;
unordered_map<Tilt, long long, MyHash> mt;
unordered_map<Tilt, long long, MyHash> mw;
int main(int argc, char* argv[]) {
  int N, M;
  long long zero = 0;
  cin >> N;
  initModPow2();
  long long ans = 1;
  for (int i = 1; i <= N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    Tilt t = Tilt(a, b);
    if (mt.count(t) == 0) {
      mt[t] = 1;
      mw[t] = 1;
    } else {
      long long v = mt[t];
      mt[t] = v + 1;
      mw[t] = v + 1;
    }
  }
  for (auto itr = mt.begin(); itr != mt.end(); ++itr) {
    if (mw.empty()) break;
    long long x, y, u, v;
    Tilt t = itr->first;
    auto tmpitr1 = mw.find(t);
    if (tmpitr1 == mw.end()) {
      continue;
    }
    u = itr->second;
    x = t.x;
    y = t.y;
    Tilt w = Tilt((-1) * y, x);
    auto tmpitr2 = mw.find(w);
    if (tmpitr2 != mw.end()) {
      v = mt[w];
    } else {
      v = 0;
    }
    long long uvcnt = countUV(u, v);
    ans = (ans * uvcnt) % MOD;
    mw.erase(t);
    mw.erase(w);
  }
  ans = ans + (zero % MOD) - 1;
  ans = ans % MOD;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
