#include <bits/stdc++.h>
#include "../lib/math/modpow.hpp"

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

using ld = long double;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  map<pair<ll, ll>, ll> mp;
  ll zero = 0;
  ll lzero = 0, rzero = 0;
  REP(i, n) {
    ll a, b; cin >> a >> b;
    if(a == 0 || b == 0) {
      if(a == 0 && b == 0) zero++;
      else if(a == 0) lzero++;
      else if(b == 0) rzero++;
      continue;
    }
    if(a < 0) {
      a = -a;
      b = -b;
    }

    ll g = __gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    mp[{a, b}]++;
  }

  ll ans = mod_pow<ll>(2, lzero, MOD);
  ans += mod_pow<ll>(2, rzero, MOD);
  ans %= MOD;
  ans += MOD - 1;
  ans %= MOD;


  map<pair<ll, ll>, bool> sel;
  for(auto &e: mp) {
    pair<ll, ll> b = {e.first.second, -e.first.first};
    if(b.first < 0) {
      b.first = -b.first;
      b.second = -b.second;
    }
    if(sel[e.first] || sel[b]) continue;
    sel[e.first] = true;
    sel[b] = true;
    ll now = 0;


    now += mod_pow<ll>(2, e.second, MOD);
    now %= MOD;
    now += mod_pow<ll>(2, mp[b], MOD);
    now %= MOD;
    now += MOD - 1;
    now %= MOD;
    ans *= now;
    ans %= MOD;
  }

  cout << (ans + MOD - 1) % MOD << endl;
}






















