#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
long long modpow(long long base, long long exponent, long long mod) {
  long long retval = 1;
  while (exponent > 0) {
    if (exponent % 2) retval = (retval * base) % mod;
    exponent /= 2;
    base = (base * base) % mod;
  }
  return retval;
}
class HashPair {
 public:
  static size_t m_hash_pair_random;
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2>& p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    size_t seed = 0;
    seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    seed ^= m_hash_pair_random + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    return seed;
  }
};
size_t HashPair::m_hash_pair_random = (size_t)random_device()();
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long modval = 1000000007;
  int n;
  cin >> n;
  unordered_map<pair<long long, long long>, int, HashPair> cnt;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a != 0 && b != 0) {
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      long long g = gcd(abs(a), abs(b));
      cnt[{a / g, b / g}]++;
    } else if (a == 0 && b == 0)
      cnt[{0, 0}]++;
    else if (a == 0)
      cnt[{0, 1}]++;
    else
      cnt[{1, 0}]++;
  }
  long long num00 = cnt[{0, 0}];
  cnt.erase(make_pair(0, 0));
  long long num = 1;
  while (!cnt.empty()) {
    auto this_item = cnt.begin();
    pair<long long, long long> this_pair = this_item->first;
    pair<long long, long long> anti_pair = {this_pair.second, -this_pair.first};
    if (anti_pair.first < 0)
      anti_pair = {-this_pair.second, this_pair.first};
    else if (anti_pair.first == 0)
      anti_pair = {0, 1};
    if (cnt.find(anti_pair) == cnt.end()) cnt[anti_pair] = 0;
    auto anti_item = cnt.find(anti_pair);
    num = num *
          (modpow(2, this_item->second, modval) - 1 +
           modpow(2, anti_item->second, modval) - 1 + 1) %
          modval;
    cnt.erase(this_item);
    cnt.erase(anti_item);
  }
  long long retval = (num00 + (num - 1)) % modval;
  cout << retval << "\n";
  return 0;
}
