#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T, T M>
class modulo {
 public:
  T data;
  modulo(T data = 0) : data(data % M) {}
  modulo operator+(const modulo &x) const { return modulo(data + x.data); }
  modulo operator-(const modulo &x) const {
    return modulo(data + (M - x.data));
  }
  modulo operator*(const modulo &x) const { return modulo(data * x.data); }
  modulo operator/(const modulo &x) const {
    return modulo(data * x.inv().data);
  }
  modulo operator+=(const modulo &x) { return data = (data + x.data) % M; }
  modulo operator-=(const modulo &x) {
    return data = (data + (M - x.data)) % M;
  }
  modulo operator*=(const modulo &x) { return data = (data * x.data) % M; }
  modulo operator/=(const modulo &x) {
    return data = (data * x.inv().data) % M;
  }
  modulo inv() const { return _pow(M - 2); }
  template <class Integer>
  modulo operator^(Integer n) const {
    if (n >= 0) {
      return _pow(n);
    } else {
      return _pow(M - 1 - (-n) % (M - 1));
    }
  }
  friend std::ostream &operator<<(std::ostream &os, const modulo &x) {
    os << x.data;
    return os;
  }

 private:
  template <class NonNegativeInteger>
  modulo _pow(NonNegativeInteger n) const {
    modulo result(1);
    modulo x(*this);
    while (n) {
      if (n & 1) {
        result *= x;
      }
      x *= x;
      n >>= 1;
    }
    return result;
  }
};
ll gcd(ll x, ll y) {
  while (y != 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  using Mod = modulo<ll, 1000000007>;
  int N;
  cin >> N;
  map<P, ll> m;
  Mod result = 1;
  for (int i = 0; i < (N); ++i) {
    ll A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      result += 1;
    } else {
      ll d = gcd(A, B);
      A /= d;
      B /= d;
      if (A < 0) {
        A *= -1;
        B *= -1;
      }
      ++m[P(A, B)];
    }
  }
  set<P> used;
  for (auto [AB, k] : m) {
    auto [A, B] = AB;
    ll A_ = B;
    ll B_ = -A;
    if (A_ < 0) {
      A_ *= -1;
      B_ *= -1;
    }
    if (used.count(P(A, B)) == 0 && used.count(P(A_, B_)) == 0) {
      result *= ((Mod(2) ^ m[P(A, B)]) + (Mod(2) ^ m[P(A_, B_)]) - 1);
      used.insert(P(A, B));
      used.insert(P(A_, B_));
    }
  }
  result -= 1;
  cout << result << endl;
  return 0;
}
