#include <bits/stdc++.h>
using namespace std;
struct XX {
  int l;
  int r;
  int len;
};
class xxGreater {
 public:
  bool operator()(const XX& riLeft, const XX& riRight) const {
    if ((riLeft.len) == (riRight.len)) {
      return riLeft.l > riRight.l;
    }
    return (riLeft.len) < (riRight.len);
  }
};
long long A[200000];
long long B[200000];
long long kai[200001];
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  while (b) {
    long long m = a % b;
    a = b;
    b = m;
  }
  return a;
}
long long mod = 1000000007;
long long fact[2000001];
long long invfact[2000001];
long long inv[2000001];
void init() {
  inv[0] = 0;
  inv[1] = 1;
  for (long long i = 2; i <= 2000000; ++i) {
    inv[i] = (mod - mod / i) * inv[mod % i];
    inv[i] %= mod;
  }
  fact[0] = 1;
  invfact[0] = 1;
  for (long long i = 1; i <= 2000000; ++i) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= mod;
    invfact[i] = invfact[i - 1] * inv[i];
    invfact[i] %= mod;
  }
}
long long cmb(long long n, long long r) {
  if (r < 0 || r > n) return 0;
  return fact[n] % mod * invfact[r] % mod * invfact[n - r] % mod;
}
int main(int argc, const char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long N;
  cin >> N;
  map<pair<long long, long long>, int> z;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    long long fugo = A[i] * B[i];
    if (fugo < 0) {
      fugo = -1;
    } else {
      fugo = 1;
    }
    A[i] = abs(A[i]);
    B[i] = abs(B[i]);
    long long tmp = gcd(A[i], B[i]);
    A[i] /= tmp;
    B[i] /= tmp;
    if (z.find(make_pair(-B[i], A[i])) == z.end()) {
      z[make_pair(-1 * fugo * B[i], A[i])] = 1;
    } else {
      z[make_pair(-1 * fugo * B[i], A[i])]++;
    }
  }
  kai[0] = 1;
  for (int i = 1; i <= N; i++) {
    kai[i] = 2 * kai[i - 1];
    kai[i] %= 1000000007;
  }
  init();
  long long hiku = 0;
  for (int i = 0; i < N; i++) {
    long long cnt = z[make_pair(A[i], B[i])];
    hiku = kai[cnt] * kai[N - 1 - i - cnt];
    hiku %= 1000000007;
    z[make_pair(A[i], B[i])]--;
  }
  long long ans = kai[N];
  ans = (ans % 1000000007 + 1000000007 - hiku % 1000000007) % 1000000007;
  cout << ans << endl;
  return 0;
}
