#include <bits/stdc++.h>
using namespace std;
class modint {
 public:
  using long long = long long;
  long long num;
  static const long long MOD = 1e9 + 7;
  static vector<modint> factorial;
  modint() : num(0){};
  modint(long long n_) : num((n_ + MOD) % MOD) {}
  modint(const modint &r) : num(r.num) {}
  operator long long() const { return (num + MOD) % MOD; }
  friend istream &operator>>(istream &is, modint &r) {
    long long num_;
    is >> num_;
    r = num_;
    return is;
  }
  modint operator+(const modint &r) const { return modint(num + r.num); }
  modint operator-(const modint &r) const { return modint(num - r.num); }
  modint operator*(const modint &r) const { return modint(num * r.num); }
  template <typename T>
  modint operator^(const T &r) const {
    if (r == 0) return 1;
    return (((*this) * (*this)) ^ (r / 2)) * modint(r & 1 ? num : 1);
  }
  modint operator/(const modint &r) const { return num * (r ^ (MOD - 2)); }
  modint operator+=(const modint &r) { return *this = *this + r; }
  modint operator-=(const modint &r) { return *this = *this - r; }
  modint operator*=(const modint &r) { return *this = *this * r; }
  modint operator/=(const modint &r) { return *this = *this / r; }
  template <typename T>
  modint operator^=(const T &r) {
    return *this = *this ^ r;
  }
  static modint pow(const modint x, long long r) { return x ^ r; }
  static modint fact(int n) {
    if ((int)factorial.size() <= n) {
      int size = factorial.size();
      factorial.resize(n + 1);
      for (int i = size; i <= n; i++) {
        factorial[i] = fact(i - 1) * modint(i);
      }
    }
    return factorial[n];
  }
  static modint C(long long n, long long r) {
    return n >= r ? fact(n) / (fact(n - r) * fact(r)) : modint(0);
  }
};
vector<modint> modint::factorial = {1};
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main(void) {
  long long n;
  cin >> n;
  long long origin = 0;
  map<pair<long long, long long>, long long> cnt1, cnt2;
  for (int i = 0; i < int(n); ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      origin++;
    } else if (a == 0 && b != 0) {
      cnt2[{0, 1}]++;
    } else if (a != 0 && b == 0) {
      cnt1[{1, 0}]++;
    } else {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      if (b < 0) {
        a = -a;
        b = -b;
      }
      if (a > 0) {
        cnt1[{a, b}]++;
      } else {
        cnt2[{a, b}]++;
      }
    }
  }
  modint res = 1;
  for (auto itr1 : cnt1) {
    auto p = itr1.first;
    long long a = p.first;
    long long b = p.second;
    if (cnt2.count({-b, a})) {
      res *= (modint::pow(2, cnt1[{a, b}]) + modint::pow(2, cnt2[{-b, a}]) -
              modint(1));
      cnt2.erase({-b, a});
    } else {
      res *= (modint::pow(2, cnt1[{a, b}]));
    }
  }
  for (auto itr2 : cnt2) {
    res *= (modint::pow(2, itr2.second));
  }
  cout << res - modint(1) << endl;
  return 0;
}
