#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

const ll mx=1e18;

void add(ll &x, ll y){
  y%=mod;
  x+=y;
  x%=mod;
}
void multiply(ll &x, ll y){
  y%=mod;
  x*=y;
  x%=mod;
}
ll mod_pow(ll x, ll n){
 ll res=1;
  while(n>0){
   if(n&1) res=res*x%mod;
   x=x*x%mod;
   n>>=1;
}
return res;
}


void solve(){
 ll n;
  cin >> n;
 ll zero=0; 
  map<P,P> mp;
 rep(i,0,n){
   ll a,b;
   cin >> a >> b;
   if(a==0&&b==0){
    ++zero;
     continue;
   }
   ll g=__gcd(a,b);
   a/=g;
   b/=g;
   if(b<0) a=-a,b=-b;
   if(b==0&&a<0) a=-a;
   
   if(a<=0) mp[P(b,-a)].se++;
   else mp[P(a,b)].fi++;
   
 }
  
  ll ans=1;
  for(auto p:mp){
    ll s=p.se.fi;
    ll t=p.se.se;
    ll now=1;
    add(now,mod_pow(2,s)-1);
    add(now,mod_pow(2,t)-1);
    multiply(ans,now);
  }
  
  ans+=zero;
  --ans;
  cout << ans%mod << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  