#include <bits/stdc++.h>
using namespace std;
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;
}
using ll = long long;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1 << 30;
const ll mod = 1000000007LL;
ll pow(ll a, ll n, ll m) {
  ll ret = 1LL;
  for (; n > 0LL; n >>= 1LL, a = a * a % m) {
    if (n % 2LL == 1LL) {
      ret = ret * a % m;
    }
  }
  return ret;
}
int main() {
  int N;
  cin >> N;
  map<double, ll> m;
  ll cnt = 0LL;
  ll cnto = 0LL;
  for (int i = 0; i < N; i++) {
    ll A, B;
    cin >> A >> B;
    if (A == 0LL && B != 0LL) {
      cnt++;
      continue;
    }
    if (A == 0LL && B == 0LL) {
      cnto++;
      continue;
    } else {
      double t = (double)B / A;
      m[t]++;
    }
  }
  for (auto x : m) {
    if (x.first == 0LL) continue;
    m[-(double)1 / (x.first)];
  }
  ll ans = 1LL;
  for (auto x : m) {
    if (x.first == 0LL) continue;
    ll &a = x.second;
    ll &b = m[-(double)1 / (x.first)];
    ans *= (pow(2LL, a, mod) + pow(2LL, b, mod) - 1LL) % mod;
    ans %= mod;
    m[x.first] = 0LL;
    b = 0LL;
  }
  ans *= (pow(2LL, cnt, mod) + pow(2LL, m[0], mod) - 1LL) % mod;
  ans %= mod;
  ans += cnto;
  ans %= mod;
  if (ans < 0LL) ans += mod;
  cout << ans - 1LL << endl;
}
