#include<bits/stdc++.h>
using namespace std;
using ll = long long ;
ll n,x,y;
using ld = long double;
map<ld,ll> mp;
const ll mod = 1000000007;
ll zero;
ll h;
ll v;
ll ans = 1;
ll qpow(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;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>x>>y;
		if(x==0 and y==0) zero++;
		else if(x==0) v++;
		else if(y==0) h++;
		else {
			ll g = __gcd(x,y);
			x/=g;
			y/=g;
			mp[(ld)y/x]++;	
		}	
	}
	for(auto i:mp){
		if(i.second==0) continue;
		ld ko = i.first;
		ll num = i.second;
		ld kt = -1.0/ko;
		ll cnt;
		if(!mp.count(kt)){
			cnt = qpow(2,num); ans=(ans*cnt)%mod;
		}else{
			cnt = qpow(2,num)-1LL+qpow(2,mp[kt]);
			cnt %= mod;
			ans=(ans*cnt)%mod;
			mp[kt]=0;
		}
	}
	if(h!=0 and v!=0){
		ll foo = qpow(2,h)-1LL+qpow(2,v);
		foo %= mod;
		ans = (ans*foo)%mod;
	}else if(h==0 and v!=0){
		ll foo = qpow(2,v);
		ans = (ans*foo)%mod;
	}else if(h!=0 and v==0){
		ll foo = qpow(2,h);
		ans = (ans*foo)%mod;
	}
	ans = (ans+zero)%mod;
	ans-=1LL;
	ans+=mod;
	ans%=mod;
	cout<<ans<<endl;
	return 0;
}