#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#pragma GCC optimize("Ofast")
using namespace std;
const long long int INF = (1LL << 62);
const long double pi = acosl((long double)-1);
const long long int mod = 1000000007;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int ddx[8] = {1, 0, -1, -1, -1, 0, 1, 1};
const int ddy[8] = {1, 1, 1, 0, -1, -1, -1, 0};
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  for (long long int i = 0; i < (long long int)((int)v.size() - 1); i++)
    cout << v[i] << " ";
  cout << v[(int)v.size() - 1];
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const map<T1, T2> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}
template <class T>
void debag(const T &obj) {
  cout << obj << endl;
}
long long int gcd(long long int a, long long int b) {
  while (1) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}
template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};
using modint = ModInt<mod>;
bool solve() {
  using P = pair<long long int, long long int>;
  long long int n;
  cin >> n;
  modint ans = 1;
  map<pair<long long int, long long int>, long long int> mp;
  vector<long long int> A(n);
  vector<long long int> B(n);
  for (long long int i = 0; i < (long long int)(n); i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 and B[i] == 0) {
      ans += 1;
      continue;
    }
    long long int gc = gcd(abs(A[i]), abs(B[i]));
    long long int a = A[i] / gc;
    long long int b = B[i] / gc;
    long long int num = 0;
    num += mp[P(-b, a)];
    num += mp[P(b, -a)];
    ans += ans / modint(2).pow(num);
    mp[P(a, b)]++;
  }
  ans -= 1;
  cout << ans << endl;
  return false;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(30);
  solve();
}
