#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1LL << 60;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
template <class T>
bool chmax(T &former, const T &b) {
  if (former < b) {
    former = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &former, const T &b) {
  if (b < former) {
    former = b;
    return true;
  }
  return false;
}
template <class T>
T sqar(T x) {
  return x * x;
}
template <class T>
inline void princ(T x) {
  cout << x << " ";
};
template <class T>
inline void print(T x) {
  cout << x << "\n";
};
template <class T>
inline void Yes(T condition) {
  if (condition)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
template <class T>
inline void YES(T condition) {
  if (condition)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
ll pow(ll x, ll y, ll mod) {
  if (y == 0) return 1;
  if (y & 1) return x * pow(x, y - 1, mod) % mod;
  ll p = pow(x, y / 2, mod);
  return p * p % mod;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(30);
  int n;
  cin >> n;
  vector<pair<PLL, int>> vt(200050);
  int d_zero = 0;
  int a_zero = 0;
  int b_zero = 0;
  for (ll i = 0; i < (ll)n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      d_zero++;
      continue;
    }
    if (a == 0) {
      a_zero++;
      continue;
    }
    if (b == 0) {
      b_zero++;
      continue;
    }
    bool swapped = false;
    bool minus = false;
    if ((a < 0 && b > 0) || (a > 0 && b < 0)) minus = true;
    a = abs(a);
    b = abs(b);
    if (a > b) {
      swap(a, b);
      swapped = true;
    }
    int which;
    if (swapped) {
      if (minus)
        which = 3;
      else
        which = 2;
    } else {
      if (minus)
        which = 1;
      else
        which = 0;
    }
    if (a == b) {
      if (minus)
        which = 4;
      else
        which = 5;
    }
    vt[i - d_zero - a_zero - b_zero] =
        (make_pair(make_pair(a / gcd(a, b), b / gcd(a, b)), which));
  }
  int cts = n - d_zero - a_zero - b_zero;
  auto it = vt.begin();
  vt.resize(cts);
  sort(it, it + cts);
  vi c(6, 0);
  ll ans = 1;
  c[vt[0].second]++;
  for (ll i = ll(1); i < ll(cts); ++i) {
    if (vt[i].first == vt[i - 1].first) {
      c[vt[i].second]++;
      continue;
    }
    ll summ = (pow(2, c[0], Mod) + pow(2, c[3], Mod) - 1 + Mod) % Mod;
    ans *= summ;
    ans %= Mod;
    summ = (pow(2, c[1], Mod) + pow(2, c[2], Mod) - 1 + Mod) % Mod;
    ans *= summ;
    ans %= Mod;
    summ = (pow(2, c[4], Mod) + pow(2, c[5], Mod) - 1 + Mod) % Mod;
    ans *= summ;
    ans %= Mod;
    c[0] = c[1] = c[2] = c[3] = c[4] = c[5] = 0;
    c[vt[i].second]++;
  }
  ll sum = (pow(2, c[0], Mod) + pow(2, c[3], Mod) - 1 + Mod);
  sum %= Mod;
  sum *= (pow(2, c[1], Mod) + pow(2, c[2], Mod) - 1 + Mod) % Mod;
  sum %= Mod;
  sum *= (pow(2, c[4], Mod) + pow(2, c[5], Mod) - 1 + Mod) % Mod;
  sum %= Mod;
  ans *= sum;
  ans %= Mod;
  ans *= (pow(2, a_zero, Mod) + pow(2, b_zero, Mod) - 1 + Mod) % Mod;
  ans %= Mod;
  ans += d_zero;
  ans -= 1;
  if (ans < 0) ans += Mod;
  ans %= Mod;
  print(ans);
  return 0;
}
