#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a%=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  map<pair<ll,ll>,ll> cor;
  rep(i,n){
    ll a,b;
    cin >> a >> b;
    if(a!=0 && b!=0){
      ll gc = gcd(abs(a),abs(b));
      a = a/gc;
      b = b/gc;
    }
    else if(a==0 && b!=0) b = b/abs(b);
    else if(a!=0 && b==0) a = a/abs(a);    
    cor[{a,b}]++;
  }
  set<pair<ll,ll>> used;
  ll ans =1;
  for(auto i:cor){
    auto tcor = i.first;
    ll x = tcor.first;
    ll y = tcor.second;
    if(x>0 && y<0){
      swap(x,y);
      x = abs(x);
    }
    else if(x<0 && y>0){
      swap(x,y);
      y = abs(y);
    }
    else if(x<0 && y<0) {
      x = abs(x);
      y = abs(y);
    }
    else if(x==0 && y==0){

    }
    else if(x==0) {
      swap(x,y);
      x = x/abs(x);
    }
    else if(y==0){
      x = x/abs(x);
    }

    assert(x>=0 && y>=0);
    

    if(used.count({x,y})) continue;
    else used.insert({x,y});
    // cout << x << " " << y << endl;
    if(x==0 && y==0){
      ans = mu(ans,ad(1,cor[{x,y}]));
      continue;
    }


    ll pre1 = cor[{x,y}] + cor[{-x,-y}];
    ll pre2 = cor[{y,-x}] + cor[{-y,x}];

    ans = mu(ans,ad(mod -1, ad(pw(2,pre1),pw(2,pre2))));
  }
  
  ans = (ans + mod - 1)%mod;
  cout << ans << endl;
  return 0;
    

}
