#include <bits/stdc++.h>
using namespace std;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
template <class T = int>
void print(vector<T> v) {
  for (auto a : v) cout << a << " ";
  cout << endl;
}
template <int MOD>
struct ModInt {
  static const int Mod = MOD;
  unsigned x;
  ModInt() : x(0) {}
  ModInt(signed sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  ModInt(signed long long sig) {
    int sigt = sig % MOD;
    if (sigt < 0) sigt += MOD;
    x = sigt;
  }
  int get() const { return (int)x; }
  ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  ModInt inverse() const {
    signed a = x, b = MOD, u = 1, v = 0;
    while (b) {
      signed t = a / b;
      a -= t * b;
      std::swap(a, b);
      u -= t * v;
      std::swap(u, v);
    }
    if (u < 0) u += Mod;
    ModInt res;
    res.x = (unsigned)u;
    return res;
  }
  ModInt pow(long long n) {
    ModInt r = 1, x2 = x;
    while (n) {
      r *= ((n % 2) ? x2 : 1);
      x2 *= x2;
      n >>= 1;
    }
    return r;
  }
};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modpow(__int128_t a, long long n, long long mo) {
  __int128_t r = 1;
  while (n) r = r * ((n % 2) ? a : 1) % mo, a = a * a % mo, n >>= 1;
  return r;
}
long long n, a[200010], b[200010], zero = 0;
map<pair<long long, long long>, long long> m;
ModInt<1000000007> ans = 1;
int main(void) {
  cin >> n;
  for (long long i = 0; i < ((long long)(n)); i++) cin >> a[i] >> b[i];
  for (long long i = 0; i < ((long long)(n)); i++) {
    long long g = gcd(a[i], b[i]);
    a[i] /= g;
    b[i] /= g;
    if (a[i] < 0) {
      a[i] = -a[i];
      b[i] = -b[i];
    }
    m[{a[i], b[i]}]++;
  }
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    long long c = itr->first.first, d = itr->first.second, cnt = itr->second;
    if (c == 0 && d == 0) {
      zero = cnt;
      continue;
    }
    long long e = d, f = -c;
    if (e < 0) {
      e = -e;
      f = -f;
    }
    if (cnt != -1) {
      ans *= modpow(2, m[{e, f}], 1e9 + 7) + modpow(2, cnt, 1e9 + 7) - 1;
    }
    m[{e, f}] = -1;
  }
  ans += zero - 1;
  cout << ans.get() << endl;
  return 0;
}
