#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  while (a > 0) {
    T t = a;
    a = b % a;
    b = t;
  }
  return b;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  map<pair<long long, long long>, long long> M;
  for (int i = 0; i < N; i++) {
    long long a = A[i];
    long long b = B[i];
    if (a != 0 || b != 0) {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      if (a < 0 || a == 0 && b < 0) {
        a *= -1;
        b *= -1;
      }
    }
    M[make_pair(a, b)]++;
  }
  long long MOD = 1000000007;
  vector<long long> P2(N + 1);
  P2[0] = 1;
  for (int i = 1; i <= N; i++) P2[i] = P2[i - 1] * 2 % MOD;
  long long ans = 1;
  for (auto m : M) {
    long long a = m.first.first;
    long long b = m.first.second;
    long long c = m.second;
    if (a == 0 && b == 0) {
      ans *= c + 1;
      ans %= MOD;
    } else {
      long long ai = b;
      long long bi = -a;
      if (ai < 0 || ai == 0 && bi < 0) {
        ai *= -1;
        bi *= -1;
      }
      if (M.count(make_pair(ai, bi)) == 0) {
        ans *= P2[c];
        ans %= MOD;
      } else if (ai > a || ai == a && bi > b) {
        long long ci = M[make_pair(ai, bi)];
        ans *= (P2[c] + P2[ci] - 1) % MOD;
        ans %= MOD;
      }
    }
  }
  cout << ans - 1 << endl;
}
