#include <bits/stdc++.h>
int mod_num = 1000000007;
int main() {
  int N;
  std::cin >> N;
  std::vector<long long> A(N);
  std::vector<long long> B(N);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i] >> B[i];
  }
  std::map<double, int> p;
  std::map<double, int> m;
  for (int i = 0; i < N; i++) {
    if (A[i] < 0) {
      A[i] = A[i] * (-1);
      B[i] = B[i] * (-1);
    }
    if (A[i] == 0 && B[i] == 0) {
      double angle = -1.0;
      auto itr = p.find(angle);
      if (itr != p.end()) {
        p[angle]++;
      } else {
        p[angle] = 1;
      }
    } else if (B[i] == 0) {
      double angle = 0.0;
      auto itr = p.find(angle);
      if (itr != p.end()) {
        p[angle]++;
      } else {
        p[angle] = 1;
      }
    } else if (A[i] == 0) {
      double angle = 0.0;
      auto itr = m.find(angle);
      if (itr != m.end()) {
        m[angle]++;
      } else {
        m[angle] = 1;
      }
    } else if (B[i] >= 0) {
      double angle = (double)A[i] / (double)B[i];
      auto itr = p.find(angle);
      if (itr != p.end()) {
        p[angle]++;
      } else {
        p[angle] = 1;
      }
    } else {
      double angle = (double)B[i] / (double)A[i] * (-1.0);
      auto itr = m.find(angle);
      if (itr != m.end()) {
        m[angle]++;
      } else {
        m[angle] = 1;
      }
    }
  }
  std::vector<int> bothA;
  std::vector<int> bothB;
  int cnt = 0;
  for (auto itr = p.begin(); itr != p.end(); itr++) {
    auto itr2 = m.find(itr->first);
    if (itr2 == m.end()) {
      cnt += itr->second;
    } else {
      bothA.push_back(itr->second);
      bothB.push_back(itr2->second);
    }
  }
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    auto itr2 = p.find(itr->first);
    if (itr2 == p.end()) {
      cnt += itr->second;
    }
  }
  long long ans = 1;
  for (int i = 0; i < cnt; i++) {
    ans = (ans * 2) % mod_num;
  }
  for (int i = 0; i < bothA.size(); i++) {
    long long tmp1 = 1;
    long long tmp2 = 1;
    for (int j = 0; j < bothA[i]; j++) {
      tmp1 = (tmp1 * 2) % mod_num;
    }
    for (int j = 0; j < bothB[i]; j++) {
      tmp2 = (tmp2 * 2) % mod_num;
    }
    long long tmp = (tmp1 + tmp2 - 1) % mod_num;
    ans = (ans * tmp) % mod_num;
  }
  std::cout << ans - 1 << std::endl;
  return 0;
}
