#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
template <class T>
inline T chmax(T &a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline T chmin(T &a, const T b) {
  return a = (a > b) ? b : a;
}
constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
ll modpow(ll a, ll b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    ll d = modpow(a, b / 2) % MOD;
    return (d * d) % MOD;
  } else {
    return (a * modpow(a, b - 1)) % MOD;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  map<double, ll> minusAdivB, BdivA;
  for (int i = 0; i < n; i++) {
    minusAdivB[1. * -a[i] / b[i]]++;
    BdivA[1. * b[i] / a[i]]++;
  }
  vector<ll> v;
  set<double> used;
  for (auto i : minusAdivB) {
    double num = i.first;
    if (used.count(num)) continue;
    ll cnt = i.second;
    ll sum = 0;
    sum += modpow(2, cnt) - 1;
    sum %= MOD;
    sum += modpow(2, BdivA[num]) - 1;
    sum %= MOD;
    sum++;
    sum %= MOD;
    v.emplace_back(sum);
    used.emplace(-1 * 1 / num);
  }
  ll ans = 1;
  for (auto i : v) {
    ans *= i;
    ans %= MOD;
  }
  ans--;
  ans += MOD;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
