#include <bits/stdc++.h>
using namespace std;
struct modint {
  using i64 = int_fast64_t;
  i64 a;
  static constexpr i64 MOD = 1000000007;
  modint() { a = 0; }
  modint(i64 a_) {
    a = a_ % MOD;
    if (a < 0) a += MOD;
  }
  modint inv() const {
    i64 n = 1, m = MOD - 2, A = a;
    while (m) {
      if (m & 1) (n *= A) %= MOD;
      (A *= A) %= MOD;
      m >>= 1;
    }
    modint y(n);
    return y;
  }
  bool operator==(const modint& x) { return a == x.a; }
  bool operator!=(const modint& x) { return a != x.a; }
  modint& operator=(const modint& x) {
    a = x.a;
    return *this;
  }
  modint operator+(const modint& x) {
    modint y;
    y.a = a + x.a;
    if (y.a > MOD) y.a -= MOD;
    return y;
  }
  modint operator-(const modint& x) {
    modint y;
    y.a = a - x.a;
    if (y.a < 0) y.a += MOD;
    return y;
  }
  modint operator*(const modint& x) {
    modint y;
    y.a = (a * x.a) % MOD;
    return y;
  }
  modint operator/(const modint& x) {
    modint y;
    y.a = (a * x.inv().a) % MOD;
    return y;
  }
  modint& operator+=(const modint& x) {
    a += x.a;
    if (a >= MOD) a -= MOD;
    return *this;
  }
  modint& operator-=(const modint& x) {
    a -= x.a;
    if (a < 0) a += MOD;
    return *this;
  }
  modint& operator*=(const modint& x) {
    (a *= x.a) %= MOD;
    return *this;
  }
  modint& operator/=(const modint& x) {
    (a *= x.inv().a) %= MOD;
    return *this;
  }
};
istream& operator>>(istream& in, modint& x) {
  int_fast64_t a_;
  in >> a_;
  modint y(a_);
  x = y;
  return in;
}
ostream& operator<<(ostream& out, const modint& x) {
  out << x.a;
  return out;
}
modint pwr(int_fast64_t a, int_fast64_t b) {
  modint _;
  int_fast64_t n = 1, A = a;
  while (b) {
    if (b & 1) (n *= A) %= modint::MOD;
    (A *= A) %= modint::MOD;
    b >>= 1;
  }
  _.a = n;
  return _;
}
long long gcd(long long a, long long b) {
  long long tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main() {
  int n;
  cin >> n;
  int both_zero = 0;
  map<pair<long long, long long>, pair<long long, long long> > mp;
  modint ans = 1;
  for (long long(i) = 0; (i) < (long long)(n); ++(i)) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      both_zero++;
      continue;
    }
    long long gcd_ = gcd(x, y);
    x /= gcd_, y /= gcd_;
    if (y < 0) x = -x, y = -y;
    if (y == 0 && x < 0) x = -x, y = -y;
    bool rot90 = (x <= 0);
    if (rot90) {
      long long tmp = x;
      x = y, y = -tmp;
    }
    if (rot90)
      mp[{x, y}].first++;
    else
      mp[{x, y}].second++;
  }
  for (auto p : mp) {
    int s = p.second.first;
    int t = p.second.second;
    modint now = 1;
    now += pwr(2, s) - 1;
    now += pwr(2, t) - 1;
    ans *= now;
  }
  ans -= 1;
  ans += both_zero;
  cout << ans << endl;
  return 0;
}
