#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long MOD = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  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;
  }
};
long long calc_gcd(const long long sx, const long long sy) {
  long long x = min(sx, sy);
  long long y = max(sx, sy);
  long long tmp;
  while (x > 0) {
    tmp = y;
    y = x;
    x = tmp % x;
  }
  return y;
}
vector<pair<long long, long long>> iwashis;
map<pair<long long, long long>, vector<int>> v_to_idx;
mint solve(const int N) {
  mint ans = 1;
  map<pair<long long, long long>, bool> used;
  for (int i = 0; i < N; i++) {
    long long my_a = iwashis[i].first;
    long long my_b = iwashis[i].second;
    if (my_a == 0 && my_b == 0) {
      continue;
    }
    if (used[make_pair(my_a, my_b)]) {
      continue;
    }
    const int num_of_my = (int)v_to_idx[make_pair(my_a, my_b)].size();
    set<pair<long long, long long>> dislike_cands;
    dislike_cands.insert(make_pair(-1 * my_b, my_a));
    dislike_cands.insert(make_pair(my_b, -1 * my_a));
    int num_of_dl = 0;
    for (auto dislike : dislike_cands) {
      vector<int> dl_idx = v_to_idx[dislike];
      num_of_dl += (int)dl_idx.size();
      used[dislike] = true;
    }
    ans *= mint(2).pow(num_of_my) + mint(2).pow(num_of_dl) - 1;
    used[make_pair(my_a, my_b)] = true;
  }
  ans -= 1;
  return ans;
}
int main(void) {
  int N;
  cin >> N;
  iwashis.resize(N);
  for (int i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
    } else if (A == 0) {
      B /= abs(B);
    } else if (B == 0) {
      A /= abs(A);
    } else {
      long long gcd = calc_gcd(abs(A), abs(B));
      A /= gcd;
      B /= gcd;
    }
    iwashis[i] = {A, B};
    v_to_idx[make_pair(A, B)].push_back(i);
  }
  cout << solve(N).x << endl;
  return 0;
}
