#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1001001001;
const long long LINF = 1001001001001001001;
void prvec(vector<long long> vec) {
  long long n = vec.size();
  cout << "------------------------------------\n";
  for (long long i = 0; i < (long long)(n); i++)
    cout << i << " " << vec.at(i) << "\n";
  cout << "------------------------------------\n";
}
void pr2d(vector<vector<long long>> vec) {
  long long h = vec.size();
  long long w = vec.at(0).size();
  cout << "------------------------------------\n";
  for (long long i = 0; i < (long long)(h); i++) {
    for (long long j = 0; j < (long long)(w); j++) {
      cout << vec.at(i).at(j) << " ";
    }
    cout << "\n";
  }
  cout << "------------------------------------\n";
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> mp_plus, mp_minus;
  long long zerocount = 0;
  long long azero = 0, bzero = 0;
  for (long long i = 0; i < (long long)(n); i++) {
    long double a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zerocount++;
      continue;
    }
    if (b == 0) {
      bzero++;
      continue;
    }
    if (a == 0) {
      azero++;
      continue;
    }
    if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
      pair<long long, long long> x = make_pair(abs(a), abs(b));
      if (mp_plus.count(x)) {
        mp_plus.at(x)++;
      } else {
        mp_plus[x] = 1;
      }
    } else {
      pair<long long, long long> x = make_pair(abs(a), abs(b));
      if (mp_minus.count(x)) {
        mp_minus.at(x)++;
      } else {
        mp_minus[x] = 1;
      }
    }
  }
  long long hategaitoucount = 0;
  long long hate_comb = 1;
  for (auto a : mp_plus) {
    if (mp_minus.count(a.first)) {
      hate_comb = hate_comb *
                  ((modpow(2, a.second, mod) - 1) +
                   (modpow(2, mp_minus.at(a.first), mod) - 1) + 1) %
                  mod;
      hategaitoucount += a.second + mp_minus.at(a.first);
    }
  }
  long long non_hate = n - hategaitoucount - zerocount - azero - bzero;
  hate_comb = hate_comb *
              ((modpow(2, azero, mod) - 1) + (modpow(2, bzero, mod) - 1) + 1) %
              mod;
  long long ans = modpow(2, non_hate, mod) * hate_comb % mod;
  ans--;
  ans += zerocount;
  cout << ans << endl;
  return 0;
}
