#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long mod = 1000000007;
long long N, A[1 << 18], B[1 << 18], power[1 << 18];
map<pair<long long, long long>, int> Map, V;
void init() {
  power[0] = 1;
  for (int i = 1; i <= 250000; i++) power[i] = (2LL * power[i - 1]) % mod;
}
int main() {
  cin >> N;
  init();
  for (int i = 1; i <= N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) continue;
    if (A[i] == 0) {
      A[i] = 0;
      B[i] = 1;
    } else if (B[i] == 0) {
      A[i] = 1;
      B[i] = 0;
    } else {
      long long v = gcd(abs(A[i]), abs(B[i]));
      A[i] /= v;
      B[i] /= v;
      if (A[i] < 0) {
        A[i] *= -1LL;
        B[i] *= -1LL;
      }
    }
    Map[make_pair(A[i], B[i])] += 1;
  }
  long long sum = 1;
  for (int i = 1; i <= N; i++) {
    if (V[make_pair(A[i], B[i])] == 1) continue;
    if (A[i] == 0 && B[i] == 0) continue;
    long long r1 = B[i], r2 = -A[i];
    if (r1 < 0) {
      r1 *= -1LL;
      r2 *= -1LL;
    }
    long long c1 = Map[make_pair(A[i], B[i])];
    long long c2 = Map[make_pair(r1, r2)];
    sum *= (power[c1] + power[c2] - 1LL + mod) % mod;
    sum %= mod;
    V[make_pair(A[i], B[i])] = 1;
    V[make_pair(r1, r2)] = 1;
  }
  cout << (sum + mod - 1LL) % mod << endl;
  return 0;
}
