#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr ll MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 


//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if( n==0) return (ll)1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / (ll)2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}

ll gcdd(ll x, ll y) {
	if (x == 0) return y;
	return gcdd(y%x, x);
}



////////////////////////////////////////////////////////////////////


int main() {
ll n;
cin>>n;

ll me[200051];
me[0]=1;
for(ll i=1;i<=200050;i++){
me[i]=me[i-1]*2;
me[i]%=MOD;
}



vector<P> vec{};
map<P, ll> mp{};

ll t=0;

rep(i,n){
  ll p,q;
  cin>>p>>q;
  ll pp=abs(p);
  ll qq=abs(q);
  if(pp!=0 && qq!=0){
    ll v=gcdd(pp, qq);
    p/=v;
    q/=v;
  }


  if(q<0 && p<0){
    p=-p;
    q=-q;
  }
  if(p<0 && q>0){
    q=-q;
    p=-p;
  }

  if(p==0 && q==0){t++; continue;}
  if(p==0)q=10;
  if(q==0)p=10;
vec.push_back(make_pair(p,q));
if(!mp.count(make_pair(p,q))) mp[make_pair(p,q)]=1;
else mp[make_pair(p,q)]++;

 
}


ll ans=(ll)1;


for(ll i=0;i<vec.size();i++){
 ll p=vec[i].first;
 ll q=vec[i].second;

ll val=(ll)0;

if(mp[make_pair(p,q)]==0){continue;}
val+=me(mp[make_pair(p,q)]);
val%=MOD;

ll newp;
ll newq;
if(p>=0 && q>=0){newp=q; newq=-p;}
else{newp=-q; newq=p;}

if(mp.count(make_pair(newp,newq))){
val+=me(mp[make_pair(newp,newq)]);
val+=MOD-1;
mp[make_pair(newp,newq)]=0;
val%=MOD;
}
ans*=val;
ans%=MOD;

mp[make_pair(p,q)]=0;
}

cout<<(ans-(ll)1+t+MOD)%MOD<<endl;

return 0;


}
