#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modpow(long long x, long long n, long long mod) {
  if (n == 0) return 1;
  long long res = modpow(x * x % mod, n / 2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long long> a(N), b(N);
  map<pair<long long, long long>, long long> mp;
  long long tmp = 0;
  for (int i = 0; i < (int)(N); i++) {
    cin >> a[i] >> b[i];
    if (a[i] * b[i]) {
      long long g = gcd(a[i], b[i]);
      a[i] /= g;
      b[i] /= g;
      if (a[i] < 0) {
        a[i] *= -1;
        b[i] *= -1;
      }
      mp[make_pair(a[i], b[i])]++;
    } else {
      if (a[i]) {
        mp[pair<long long, long long>(1, 0LL)]++;
      } else {
        if (b[i]) {
          mp[pair<long long, long long>(0LL, -1)]++;
        } else {
          tmp++;
        }
      }
    }
  }
  long long ans = 1;
  for (auto [k, v] : mp) {
    long long t;
    pair<long long, long long> tm;
    if (k.second >= 0) {
      tm = pair<long long, long long>(k.second, -k.first);
    } else {
      tm = pair<long long, long long>(-k.second, k.first);
    }
    t = mp[tm];
    if (v) {
      ans *= (modpow(2, v, MOD) + modpow(2, t, MOD) - 1) % MOD;
      mp[tm] = 0;
    }
  }
  if (!tmp) {
    --ans;
  }
  cout << ans << endl;
}
