#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define pll pair<ll,ll>
const int mod=(int)1e9+7;

using namespace std;
pll reduce(ll a,ll b){
   if(b==0) return make_pair(1,0);
   if(a==0) return make_pair(0,1);
   //if(a<0 and b<0)
   //   a=-a,b=-b;
   if(a<0)
      a=-a,b=-b;
   ll g=__gcd(abs(a),abs(b));
   return make_pair(a/g,b/g);
}
pll comp(pll frac){
   pll r = make_pair(frac.second,frac.first);
   if(r.first<0) r.first=-r.first;
   else r.second=-r.second;
   return r;
}
ll fpow(ll a,ll b){
   a%=mod;
   ll res=1;
   while(b>0){
     if(b&1) res=(res*1LL*a)%mod;
     a=(a*1LL*a)%mod;
     b/=2;
   }
   return res;
}

int main(){
   int n;
   ll a,b,ans=1,tc=0;
   cin>>n;
   map<pll,int> cnt;
   for(int i=0;i<n;i++){
      cin>>a>>b;
      cnt[reduce(a,b)]++;
   }
   auto x = cnt.find({0,0});
   if(x!=cnt.end()){
      tc=x->second;
      cnt.erase({0,0});
   }
   for(auto x:cnt){
      pll frac=x.first;
      ll c=x.second;
      auto y=cnt.find(comp(frac));
      if(y==cnt.end())
         ans=(ans*fpow(2,c))%mod;
      else{
         ll temp=(fpow(2,c)+fpow(2,y->second)-1+mod)%mod;
         ans=(ans*temp)%mod;
         cnt.erase(y);
      }	
   }
   ans=(ans+tc+mod-1)%mod;
   cout<<ans;
   return 0;

} 
