#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long mpow(long long a, long long n) {
  long long p = 1;
  while (n) {
    if (n & 1) p = (p * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return p;
}
int main() {
  int n;
  cin >> n;
  map<long long, int> mp;
  for (int i = 0; i < (n); ++i) {
    long long a, b;
    cin >> a >> b;
    long long c = (a * b) % MOD;
    mp[c]++;
  }
  long long ms = 0;
  for (pair<long long, int> c : mp) {
    if (mp[-c.first] > 0) {
      int num = c.second + mp[-c.first];
      ms +=
          (mpow(2, c.second) - 1) + (mpow(2, mp[-c.first]) - 1) * mpow(2, num);
      ms %= MOD;
      mp[-c.first] = 0;
    }
  }
  long long ans = mpow(2, n) - ms;
  while (ans > 0) {
    ans += MOD;
  }
  cout << ans << endl;
  return 0;
}
