#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
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;
  }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};
int gcd(int a, int b) {
  int tmp;
  while (b) {
    tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}
int main() {
  int N;
  cin >> N;
  int cntABZero = 0, cntAZero = 0, cntBZero = 0;
  vector<pair<int, int> > p;
  int a, b;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cntABZero++;
    } else if (a == 0)
      cntAZero++;
    else if (b == 0)
      cntBZero++;
    else
      p.push_back(pair<int, int>(a, b));
  }
  for (int i = 0; i < p.size(); i++) {
    int d = gcd(p[i].first, p[i].second);
    p[i].first /= d;
    p[i].second /= d;
  }
  map<pair<int, int>, pair<int, int> > mp;
  for (int i = 0; i < p.size(); i++) {
    int x, y;
    tie(x, y) = p[i];
    int cnt = (x < 0) + (y < 0);
    if (cnt == 1)
      mp[pair<int, int>(abs(x), abs(y))].first++;
    else
      mp[pair<int, int>(abs(y), abs(x))].second++;
  }
  mint two = 2;
  mint ans = 1;
  for (auto m : mp) {
    int x, y;
    tie(x, y) = m.second;
    ans *= two.pow(x) + two.pow(y) - 1;
  }
  ans *= two.pow(cntAZero) + two.pow(cntBZero) - 1;
  ans += cntABZero;
  ans -= 1;
  cout << ans << '\n';
}
