#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::deque;
using std::get;
using std::greater;
using std::ifstream;
using std::ios_base;
using std::less;
using std::list;
using std::lower_bound;
using std::make_pair;
using std::make_tuple;
using std::map;
using std::max;
using std::max_element;
using std::min;
using std::min_element;
using std::multimap;
using std::multiset;
using std::ofstream;
using std::pair;
using std::priority_queue;
using std::queue;
using std::set;
using std::stack;
using std::string;
using std::swap;
using std::tuple;
using std::unordered_map;
using std::unordered_multimap;
using std::unordered_set;
using std::upper_bound;
using std::vector;
[[maybe_unused]] const string endl = "\n";
[[maybe_unused]] const string sep = " ";
[[maybe_unused]] const string yes = "YES\n";
[[maybe_unused]] const string no = "NO\n";
[[maybe_unused]] const string ng = "NG\n";
[[maybe_unused]] const string ok = "OK\n";
[[maybe_unused]] const double pi = acos(-1);
[[maybe_unused]] const unsigned long long modular = 1000000007;
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  cout.precision(15);
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> M;
  set<pair<pair<long long, long long>, pair<long long, long long>>> S;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    auto g = gcd(a, abs(b));
    long long x = b;
    long long y = -a;
    if (b < 0) {
      x = -x;
      y = -y;
    }
    if (b > 0) {
      S.insert({{a / g, b / g}, {x / g, y / g}});
    } else {
      S.insert({{x / g, y / g}, {a / g, b / g}});
    }
    ++M[{a / g, b / g}];
  }
  long long result = 1;
  vector<long long> T(n + 1);
  T[0] = 1;
  for (int i = 1; i <= n; ++i) {
    T[i] = (T[i - 1] * 2) % modular;
  }
  for (auto t : S) {
    result *= T[M[t.first]] + T[M[t.second]] - 1;
    result %= modular;
  }
  cout << result - 1;
}
