#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using pli = pair<lint, lint>;
using v1li = vector<lint>;
constexpr lint mod1 = 1e9+7;

int main(){
  lint n, zf = 0, zs = 0, zfs = 0, a, pa = 1; cin >> n;
  vector<pli> v(n); map<pli, int> pl, mi; v1li p(n+1, 1);
  rep(i, n){
    cin >> v[i].fi >> v[i].se;
    if(v[i].fi == 0 && v[i].se == 0) ++zfs;
    else if(v[i].fi == 0) ++zf;
    else if(v[i].se == 0) ++zs;
    else{
      lint ta = abs(v[i].fi), tb = abs(v[i].se), tc = __gcd(ta, tb);
      if((v[i].fi > 0 && v[i].se > 0) || (v[i].fi < 0 && v[i].se < 0)) pl[{ta/tc, tb/tc}]++;
      else mi[{ta/tc, tb/tc*(-1)}]++;
    }
    p[i+1] = p[i]*2;
    p[i+1] %= mod1;
  }
  for(auto tp: pl){
    if(tp.se > 0 && mi[{tp.fi.se, tp.fi.fi*(-1)}] > 0){
      pa *= (p[tp.se] + p[mi[{tp.fi.se, tp.fi.fi*(-1)}]]) % mod1 - 1;
      pa %= mod1;
      n -= tp.se + mi[{tp.fi.se, tp.fi.fi*(-1)}];
    }
  }
  if(zf > 0 && zs > 0){
    pa *= (p[zf] + p[zs]) % mod1 - 1;
    pa %= mod1;
    n -= zf + zs;
  }
  n -= zfs;
  a = p[n];
  a *= pa;
  --a;
  a %= mod1;
  cout << a << endl;
  return 0;
}