#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll 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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n;
  cin >> n;
  vector<mint> p(n + 1);
  p[0] = 1;
  for (int i = 0; i < n; ++i) p[i + 1] = p[i] * 2;
  map<P, ll> cnt;
  ll zero = 0;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++zero;
      continue;
    }
    if (a != 0 && b != 0) {
      ll m = gcd(abs(a), abs(b));
      a /= m;
      b /= m;
    }
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    cnt[P(a, b)]++;
  }
  mint ans = 1;
  ll m = 0;
  for (auto i : cnt) {
    ll a = i.first.first, b = i.first.second;
    ll s = i.second;
    cnt[P(a, b)] = 0;
    if (b < 0) {
      a *= -1;
      b *= -1;
    }
    ll t = cnt[P(b, -a)];
    if (t == 0) {
      m += s;
    } else {
      ans *= p[s] + p[t] - 1;
      cnt[P(b, -a)] = 0;
    }
  }
  ans *= p[m];
  ans -= 1;
  ans += zero;
  cout << ans << endl;
}
