#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, const U &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
template <int mod = 1000000007>
class mInt {
 public:
  int x;
  mInt() : x(0) {}
  int absmod(long long in) {
    if (in >= 0)
      return in % mod;
    else
      return (in % mod) + mod;
  }
  mInt(long long in) { x = absmod(in); }
  ~mInt() {}
  friend ostream &operator<<(ostream &os, const mInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, mInt &a) {
    int64_t t;
    is >> t;
    a = mInt<mod>(t);
    return (is);
  }
  mInt &operator+=(const mInt p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  mInt &operator-=(const mInt p) {
    if ((x -= p.x) < 0) x += mod;
    return *this;
  }
  mInt &operator*=(const mInt p) {
    x = (int)((long long)x * p.x % mod);
    return *this;
  }
  mInt &operator/=(const mInt p) {
    x = (int)((long long)x * (p.pow(-1)).x % mod);
    return *this;
  }
  mInt &operator=(const long long p) {
    x = absmod(p);
    return *this;
  }
  mInt pow(long long n) const {
    mInt<mod> ret(1), tmp(x);
    if (n == 0)
      return ret;
    else if (n < 0)
      n += mod - 1;
    while (n > 1) {
      if (n % 2 == 0) {
        n /= 2;
        tmp *= tmp;
      } else {
        --n;
        ret *= tmp;
      }
    }
    ret *= tmp;
    return ret;
  }
  mInt operator+(const mInt &p) const { return mInt(*this) += p; }
  mInt operator-(const mInt &p) const { return mInt(*this) -= p; }
  mInt operator*(const mInt &p) const { return mInt(*this) *= p; }
  mInt operator*(const long long &p) const {
    mInt<mod> make_pair;
    make_pair.x = p;
    return mInt(*this) *= make_pair;
  }
  mInt operator/(const mInt &p) const { return mInt(*this) /= p; }
  bool operator==(const mInt &p) const { return x == p.x; }
  bool operator!=(const mInt &p) const { return x != p.x; }
  bool operator>(const mInt &p) const { return x > p.x; }
  bool operator<(const mInt &p) const { return x < p.x; }
  bool operator>=(const mInt &p) const { return x >= p.x; }
  bool operator<=(const mInt &p) const { return x <= p.x; }
};
template <int mod = 1000000007>
class mFact {
 public:
  int n;
  mFact() : n(1000) { prepareFactArray(); }
  mFact(int _n) : n(_n) { prepareFactArray(); }
  vector<mInt<mod>> fac;
  vector<mInt<mod>> fiv;
  void prepareFactArray() {
    fac.resize(n + 10);
    fiv.resize(n + 10);
    fac[0] = 1;
    for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i;
    fiv[n] = fac[n].pow(-1);
    for (int i = n; i >= 0; --i) fiv[i - 1] = fiv[i] * i;
  }
  mInt<mod> nCr(long long _n, long long r) {
    mInt<mod> p(1), q(1), z(0);
    if (r > _n) return z;
    r = min(r, _n - r);
    if (_n > n) {
      for (long long i = 0; i < r; ++i) {
        p *= _n - i;
        q *= r - i;
      }
      return p / q;
    } else
      return fac[_n] * fiv[r] * fiv[_n - r];
  }
};
int main() {
  bool flag = false;
  long long ans = 0, sum = 0;
  int n, m;
  cin >> n;
  mInt<1000000007> mAns(1);
  vector<long long> a(n), b(n);
  map<long double, pair<int, int>> arg;
  pair<int, int> axis(0, 0);
  bool z = false;
  for (int i = 0, _i = (n); i < _i; ++i) {
    cin >> a[i] >> b[i];
    long double ai = a[i];
    long double bi = b[i];
    if (bi == 0) {
      if (ai == 0) {
        z = true;
      } else {
        axis.first++;
      }
    } else {
      long double t = ai / bi;
      arg[t].first++;
    }
  }
  mInt<1000000007> tw(2);
  for (auto p : arg) {
    if (p.second.second == 1) continue;
    long double t = p.first;
    long double tinv = (long double)-1.0 / t;
    int nQ = arg[tinv].first;
    int nP = p.second.first;
    arg[tinv].second = 1;
    mInt<1000000007> mul = tw.pow(nQ) + tw.pow(nP) - 1;
    mAns *= mul;
  }
  if (!z) mAns -= 1;
  cout << mAns << endl;
  return 0;
}
