#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
std::string printVector(const std::vector<T> &data) {
  std::stringstream ss;
  std::ostream_iterator<T> out_it(ss, ", ");
  ss << "[";
  std::copy(data.begin(), data.end() - 1, out_it);
  ss << data.back() << "]";
  return ss.str();
}
template <typename T>
void print_array(const T &ary, int size) {
  for (int i = (0); i < (size); ++i) {
    cout << ary[i] << " ";
  }
  cout << endl;
}
const int mod = 1e9 + 7;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
long long int gcd(long long int a, long long int b) {
  if (a < b) swap(a, b);
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
struct mint {
  long long x;
  mint(long long x = 0) : x(x >= 0 ? x % mod : x % mod + mod) {}
  mint &operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
signed main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(12);
  int N;
  cin >> N;
  map<pair<long long, long long>, long long> mp;
  long long z1 = 0, z2 = 0, z3 = 0;
  for (int i = (0); i < (N); ++i) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 and B == 0)
      z3++;
    else if (A == 0)
      z1++;
    else if (B == 0)
      z2++;
    else {
      if (A * B < 0) {
        A = abs(A);
        B = abs(B);
        long long g = gcd(A, B);
        A /= g;
        B /= g;
        mp[pair<long long, long long>(-A, B)]++;
      } else {
        A = abs(A);
        B = abs(B);
        long long g = gcd(A, B);
        A /= g;
        B /= g;
        mp[pair<long long, long long>(A, B)]++;
      }
    }
  }
  mint ans = 1;
  mint two = 2;
  set<pair<long long, long long> > s;
  for (auto p : mp) {
    if (s.find(p.first) != s.end()) continue;
    long long A, B, cnt;
    tie(A, B) = p.first;
    cnt = p.second;
    long long ocnt;
    if (A < 0)
      ocnt = mp[pair<long long, long long>(B, -A)];
    else
      ocnt = mp[pair<long long, long long>(-B, A)];
    ans *= two.pow(cnt) + two.pow(ocnt) - 1;
    if (A < 0)
      s.insert(pair<long long, long long>(B, -A));
    else
      s.insert(pair<long long, long long>(-B, A));
  }
  ans *= two.pow(z1) + two.pow(z2) - 1;
  ans += z3 - 1;
  cout << ans.x << endl;
}
