#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
long long binary_pow(long long a, long long N) {
  long long ans = 1;
  long long tmp = a;
  while (N > 0) {
    if (N % 2 == 1) {
      ans *= tmp;
      ans %= mod;
    }
    N /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  map<double, long long> mp;
  for (int i = (int)(0); i < (int)(N); i++) {
    cin >> A[i] >> B[i];
    mp[(double)A[i] / B[i]]++;
  }
  set<double> done;
  long long ans = 1;
  for (auto m : mp) {
    double val = m.first;
    if (done.count(-1 / val)) continue;
    if (mp.count(-1 / val)) {
      (ans *= (binary_pow(2, m.second) + binary_pow(2, mp[-1 / val]) - 1) %
              mod) %= mod;
    } else {
      (ans *= binary_pow(2, m.second)) %= mod;
    }
    done.insert(val);
  }
  cout << (ans + mod - 1) % mod << endl;
  return 0;
}
