#include <bits/stdc++.h>

using namespace std;

template <long long Mod> struct ModInt { /* {{{ */
  long long v;
  constexpr ModInt(const long long x = 0) {
    v = x % Mod;
    if (v < 0) {
      v += Mod;
    }
  }
  constexpr ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; }
  constexpr ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; }
  constexpr ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; }
  constexpr ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; }
  const ModInt &operator+=(const ModInt rhs) {
    v += rhs.v;
    if (v >= Mod) {
      v -= Mod;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) {
    if (v < rhs.v) {
      v += Mod;
    }
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) {
    v = v * rhs.v % Mod;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) {
    long long exp = Mod - 2;
    while (exp) {
      if (exp & 1) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  friend ostream &operator<<(ostream &s, ModInt<Mod> m) {
    s << m.v;
    return s;
  }
  friend istream &operator>>(istream &s, ModInt<Mod> m) {
    s >> m.v;
    return s;
  }
}; /* }}} */

const int mod = 1e9 + 7;
using modint = ModInt<mod>;

long long gcd(int a, int b) {
  a = abs(a);
  b = abs(b);
  if (b == 0) return a;
  return gcd(b, a % b);
}

modint pow_2(int exp) {
  modint a = 2;
  modint ret = 1;
  while (exp) {
    if (exp & 1) ret *= a;
    a *= a;
    exp >>= 1;
  }
  return ret;
}

int main() {
  int N;
  cin >> N;
  map<pair<long long, long long>, int> m;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    long long c = gcd(a, b);
    a /= c;
    b /= c;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    m[{a, b}]++;
  }
  map<pair<long long, long long>, bool> done;
  modint ans = 1;
  for (auto p : m) {
    if (done[p.first]) continue;
    if (!p.second) continue;

    modint v = pow_2(p.second);
    done[p.first] = true;

    auto a = p.first.first;
    auto b = p.first.second;
    pair<long long, long long> p2;
    if (b > 0) {
      p2 = {b, -a};
    } else {
      p2 = {-b, a};
    }
    if (m[p2] > 0) {
      v += pow_2(m[p2]) - 1;
      done[p2] = true;
    }
    ans *= v;
  }
  cout << ans - 1 << endl;

  return 0;
}
/* vim:set fdm=marker: */
