#include <bits/stdc++.h>
using namespace std;
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
using namespace std;
long long power(long long x, unsigned long long y, unsigned long long m) {
  if (y == 0) return 1;
  unsigned long long p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  if (y & 1)
    return ((x % m) * p) % m;
  else
    return p;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  for (long long tp = 1; tp <= T; ++tp) {
    long long n;
    cin >> n;
    map<long long, long long> m;
    long long bad = 0;
    for (long long i = 1; i <= n; ++i) {
      long long a, b;
      cin >> a >> b;
      long long prod = a * b;
      long long freq = m[-prod];
      bad = (bad + freq * power(2, n - freq - 1, (long long)(1e9 + 7))) %
            (long long)(1e9 + 7);
      m[prod] += 1;
    }
    long long ans =
        (power(2, n, (long long)(1e9 + 7)) - 1 - bad + (long long)(1e9 + 7)) %
        (long long)(1e9 + 7);
    cout << ans;
    cout << '\n';
  }
  return 0;
}
