#include <bits/stdc++.h>
using namespace std;
long long pow_mod(long long a, long long n) {
  long long result = 1;
  long long a_i = a;
  long long n_tmp = n;
  while (n_tmp > 0) {
    if (n_tmp & 0b1) {
      result = (result * a_i) % 1000000007;
    }
    a_i = a_i * a_i % 1000000007;
    n_tmp = n_tmp >> 1;
  }
  return result;
}
long long fact_mod(long long k) {
  long long result = 1;
  for (int i = 1; i <= k; i++) {
    result = (result * i) % 1000000007;
  }
  return result;
}
vector<long long> fact_mod_vector(long long k) {
  vector<long long> result(k + 1, 1);
  result[0] = 1;
  for (int i = 1; i <= k; i++) {
    result[i] = (result[i - 1] * i) % 1000000007;
  }
  return result;
}
long long inv_mod(long long k) { return pow_mod(k, 1000000007 - 2); }
long long comb_mod(long long n, long long k, vector<long long> *fact_result) {
  return ((*fact_result)[n] *
          inv_mod(((*fact_result)[k] * (*fact_result)[n - k]) % 1000000007)) %
         1000000007;
}
long long my_gcd(long long A, long long B) {
  while (A > 0 && B > 0) {
    if (A > B) {
      A = A % B;
    } else {
      B = B % A;
    }
  }
  return A + B;
}
int main() {
  int N;
  scanf("%d", &N);
  map<pair<long long, long long>, pair<long long, long long>> c;
  for (int i = 0; i < N; i++) {
    long long A, B;
    scanf("%lld %lld", &A, &B);
    if (A == 0 || B == 0) {
      c[make_pair(0, 0)].first++;
      break;
    }
    long long gcd = my_gcd(abs(A), abs(B));
    A = A / gcd;
    B = B / gcd;
    if (B < 0) {
      A = -A;
      B = -B;
    }
    if (A > 0) {
      c[make_pair(A, B)].first++;
    } else {
      c[make_pair(B, -A)].second++;
    }
  }
  long long result = 1;
  for (auto i : c) {
    long long tmp = ((pow_mod(2, i.second.first) - 1) +
                     (pow_mod(2, i.second.second) - 1) + 1) %
                    1000000007;
    result = (result * tmp) % 1000000007;
  }
  cout << result - 1;
  return 0;
}
