#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 xori = tcor.first;
    ll yor = tcor.second;
    if(xori >0 && yor<0){
      swap(xori,yor);
      xori = abs(xori);
    }
    else if(xori < 0 && yor>0){
      swap(xori,yor);
      yor = abs(yor);
    }
    else if(xori < 0 && yor<0) {
      xori = abs(xori);
      yor = abs(yor);
    }
    else if(xori==0) {
      swap(xori,yor);
      xori = abs(xori);
    }
    else if(yor==0){
      xori = abs(xori);
    }
    

    if(used.count({xori,yor})) continue;
    else used.insert({xori,yor});
    // cout << xori << " " << yor << endl;
    if(xori==0 && yor==0){
      ans = mu(ans,1+cor[{xori,yor}]);
      continue;
    }
    ll pre1 = cor[{xori,yor}];
    ll pre2 = cor[{yor,-xori}];
    ll pre3 = cor[{-xori,-yor}];
    ll pre4 = cor[{-yor,xori}];
    // cout << pre1 << " "<< pre2 << " "<< pre3 << " " << pre4 << endl;
    ll tmp = ad(ad(pw(2,pre1),pw(2,pre2)),ad(pw(2,pre3),pw(2,pre4)));
    tmp = (tmp +mod - 3)%mod;
    // cout << tmp << endl;
    tmp = ad(tmp,mu(((pw(2,pre2)+mod-1)%mod),((pw(2,pre4)+mod-1)%mod)));
    tmp = ad(tmp,mu(((pw(2,pre1)+mod-1)%mod),((pw(2,pre3)+mod-1)%mod)));
    ans = mu(ans,tmp);
  }
  
  ans = (ans + mod - 1)%mod;
  cout << ans << endl;
  return 0;
    

}
