#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1 << 30;
constexpr long long LINF = 1LL << 60;
constexpr long long mod = 1e9 + 7;
constexpr int NIL = -1;
template <class T>
inline bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
struct mint {
  long long x;
  mint(long long x = 0) : x(x % mod) {}
  bool operator==(const mint a) const { return x == a.x; }
  bool operator!=(const mint a) const { return x != a.x; }
  bool operator>=(const mint a) { return (x >= a.x) ? 1 : 0; }
  bool operator<(const mint a) { return !(*this >= a); }
  bool operator>(const mint a) { return (x > a.x) ? 1 : 0; }
  bool operator<=(const mint a) { return !(*this > a); }
  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 gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int n;
map<pair<int, int>, int> mp;
int both0 = 0;
int main() {
  cin >> n;
  for (int i = (1); i <= (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 and b == 0) {
      both0++;
      continue;
    }
    if (a == 0) {
      mp[{0, 1}]++;
      continue;
    }
    if (b == 0) {
      mp[{1, 0}]++;
      continue;
    }
    long long gd = gcd(a, b);
    a /= gd;
    b /= gd;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    mp[{a, b}]++;
  }
  mint ans = mint(1);
  for (auto [k, v] : mp) {
    if (v == 0) continue;
    if (k.first == 0) {
      if (mp[{1, 0}] > 0)
        ans *= mint(2).pow(v) + mint(2).pow(mp[{1, 0}]) - 1;
      else
        ans *= mint(2).pow(v);
      mp[{0, 1}] = 0;
      mp[{1, 0}] = 0;
    } else if (k.second == 0) {
      if (mp[{0, 1}] > 0)
        ans *= mint(2).pow(v) + mint(2).pow(mp[{0, 1}]) - 1;
      else
        ans *= mint(2).pow(v);
      mp[{0, 1}] = 0;
      mp[{1, 0}] = 0;
    } else {
      long long ca = abs(k.second);
      long long cb = k.first * (k.first * k.second < 0 ? 1 : -1);
      if (mp[{ca, cb}] > 0)
        ans *= mint(2).pow(v) + mint(2).pow(mp[{ca, cb}]) - 1;
      else
        ans *= mint(2).pow(v);
      mp[{k.first, k.second}] = 0;
      mp[{ca, cb}] = 0;
    }
  }
  ans -= 1;
  ans += both0;
  cout << ans.x << "\n";
  return 0;
}
