#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
const long long FAC_MAX = 510000;
long long fac[FAC_MAX];
long long finv[FAC_MAX];
long long mod_pow(long long x, long long n) {
  if (n == 0) {
    return 1;
  } else if (n % 2 == 1) {
    return mod_pow(x, n - 1) * x % MOD;
  } else {
    long long t = mod_pow(x, n / 2);
    return t * t % MOD;
  }
}
void init() {
  fac[0] = 1;
  for (long long i = 1; i < FAC_MAX; ++i) {
    fac[i] = (fac[i - 1] * i) % MOD;
  }
  for (long long i = 0; i < FAC_MAX; ++i) {
    finv[i] = mod_pow(fac[i], MOD - 2);
  }
}
long long comb(long long n, long long r) {
  if (n < r) {
    return 0;
  }
  if (n < 0 || r < 0) {
    return 0;
  }
  return (((fac[n] * finv[r]) % MOD) * finv[n - r]) % MOD;
}
int main() {
  long long n;
  cin >> n;
  map<long double, long long> mp;
  map<long double, long long> mpr;
  vector<long double> a(n);
  vector<long double> b(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    mp[a[i] / b[i]]++;
    mpr[b[i] / a[i]]++;
  }
  long long ans = mod_pow(2, n) - 1;
  init();
  long long bad_c = 0;
  for (auto t : mp) {
    if (mpr[-t.first] > 0) {
      long long sum = t.second + mpr[-t.first];
      long long com = t.second * mpr[-t.first];
      bad_c += comb(com, 1) * mod_pow(2, n - sum);
    }
  }
  bad_c /= 2;
  bad_c %= MOD;
  ans += MOD;
  ans -= bad_c;
  ans %= MOD;
  cout << ans << endl;
}
