#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1000000007;
struct mint {
  int64_t x;
  mint(int64_t x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(int64_t n) const {
    if (n == 0) return 1;
    mint t = pow(n >> 1);
    t *= t;
    if (n & 1) t *= *this;
    return t;
  }
  mint inv() const { return pow(MOD - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
int64_t gcd(int64_t a, int64_t b) {
  if (a < b) {
    swap(a, b);
  }
  while (b != 0) {
    int64_t t = a % b;
    a = b;
    b = t;
  }
  return a;
}
int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  map<pair<int64_t, int64_t>, int> m;
  mint res = 0;
  int zz = 0;
  for (int i = 0; i < N; i++) {
    int64_t Ai = A.at(i), Bi = B.at(i);
    if (Bi < 0) {
      Ai *= -1;
      Bi *= -1;
    }
    if (Ai == 0 && Bi == 0) {
    } else if (Ai == 0) {
      Bi = 1;
    } else if (Bi == 0) {
      Ai = 1;
    } else {
      int64_t d = gcd((Ai < 0) ? -Ai : Ai, Bi);
      Ai /= d;
      Bi /= d;
    }
    if (Ai == 0 && Bi == 0) {
      zz++;
      res += 1;
    } else if (Ai == 0) {
      int bad = m[make_pair(1, 0)];
      res += mint(2).pow(i - bad - zz);
    } else if (Bi == 0) {
      int bad = m[make_pair(0, 1)];
      res += mint(2).pow(i - bad - zz);
    } else {
      int64_t Aj, Bj;
      if (Ai < 0) {
        Aj = Bi;
        Bj = -Ai;
      } else {
        Aj = -Bi;
        Bj = Ai;
      }
      int bad = m[make_pair(Aj, Bj)];
      res += mint(2).pow(i - bad - zz);
    }
    m[make_pair(Ai, Bi)] += 1;
  }
  cout << res.x << endl;
}
