#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
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 {
    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(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 {
    mint res(*this);
    return res /= a;
  }
};
ll GCD(ll a, ll b) { return (b > 0) ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
int main() {
  int n;
  cin >> n;
  map<P, ll> mp;
  for (int i = 0; i < (n); ++i) {
    ll a, b;
    cin >> a >> b;
    if (a <= 0) {
      a = -a;
      b = -b;
    }
    if (a != 0 && b != 0) {
      ll gcd = GCD(a, abs(b));
      a /= gcd;
      b /= gcd;
    }
    mp[make_pair(a, b)]++;
  }
  int a0 = 0;
  int b0 = 0;
  int ab = 0;
  ll mod = 1000000007;
  ll ans = 1;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    P p = i->first;
    ll c = i->second;
    ll a = p.first;
    ll b = p.second;
    if (a == 0 && b == 0) {
      ab++;
    } else if (a == 0) {
      a0++;
    } else if (b == 0) {
      b0++;
    } else if (b > 0) {
      if (mp.find(make_pair(b, -a)) == mp.end()) {
        ans = ans * 2 % mod;
      } else {
        ll c2 = mp[make_pair(b, -a)];
        ll na = 1;
        ll nb = 1;
        for (int i = 0; i < (c); ++i) {
          na = na * 2 % mod;
        }
        for (int i = 0; i < (c2); ++i) {
          nb = nb * 2 % mod;
        }
        na--;
        nb--;
        ll mm = na + nb + 1;
        mm %= mod;
        ans = ans * mm % mod;
      }
    } else {
      if (mp.find(make_pair(-b, a)) == mp.end()) {
        ans = ans * 2 % mod;
      }
    }
  }
  ll na = 1;
  ll nb = 1;
  for (int i = 0; i < (a0); ++i) {
    na = na * 2 % mod;
  }
  for (int i = 0; i < (b0); ++i) {
    nb = nb * 2 % mod;
  }
  na--;
  nb--;
  ll mm = na + nb + a0 * b0 + 1;
  mm %= mod;
  ans = ans * mm % mod;
  ans = (ans + ab) % mod;
  cout << ans - 1 << endl;
}
