#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long n, a, b;
  cin >> n;
  map<__int128, long long> mp;
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> a >> b;
    mp[(__int128)a * b]++;
  }
  long long ans = 1;
  for (auto x : mp) {
    if (mp[-x.first] == 0) {
      ans *= pow(2, x.second);
      ans %= mod;
      mp[x.first] = 0;
    } else {
      ans *=
          ((long long)pow(2, x.second) + (long long)pow(2, mp[-x.first]) - 1) %
          mod;
      ans %= mod;
      mp[-x.first] = mp[x.first] = 0;
    }
  }
  cout << ans - 1 << endl;
  return 0;
}
