#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;


const int MAXN=2e5+10;
int p[MAXN],sz[MAXN];
int find(int x){return p[x]=p[x]==x?x:find(p[x]);}
void join(int x, int y){p[find(x)]=find(y);}

int sg(ll x){return x<0?-1:x>0;}

ii frac(ll a, ll b){
	if(!a||!b)return {0,1};
	ll ms=sg(a)*sg(b)<0;
	a=abs(a); b=abs(b);
	ll g=__gcd(a,b); a/=g; b/=g;
	if(ms) a=-a;
	return {a,b};
}

ll MOD=1e9+7;

ll fpow(ll base, ll exp) {
	ll result = 1;
	while(exp){
		if(exp & 1) result = (result*base) % MOD;
		exp >>= 1;
		base = (base*base) % MOD;
	}
	return result;
}

vector<ll> g[MAXN];
ll n;

ll dp[MAXN];

ll solve(int pos){
	if(pos==n)return 1;
	ll &r=dp[pos];
	if(r>=0)return r;
	r=solve(pos+1);
	for(auto x:g[pos]){
		ll ws=(fpow(2,x)-1+MOD)%MOD;
		r=(r+ws*solve(pos+1))%MOD;
	}
	return r;
}

int main(){FIN;
	cin>>n;
	fore(i,0,n) p[i]=i;
	map<ii,int> mp;
	vector<ii> v;
	vector<ll> sz;
	
	map<ii,int> concha;
	ll z00=0,z01=0,z10=0;
	fore(i,0,n){
		ll a,b; cin>>a>>b;
		if(!a&&!b) z00++;
		else if(!a) z01++;
		else if(!b) z10++;
		else concha[frac(a,b)]++;
	}
	for(auto x:concha) v.pb(x.fst),sz.pb(x.snd);
	n=SZ(v);
	fore(i,0,n){
		ii f=v[i];
		if(mp.count(f)) join(mp[f],i);
		mp[frac(-v[i].snd,v[i].fst)]=i;
	}
	fore(i,0,n) g[find(i)].pb(sz[i]);
	memset(dp,-1,sizeof(dp));
	
	
	//elijo 00
	ll ws=z00+1;	//solo puedo tomar 1
	
	//elijo 01		//cualquier cantidad
	ws=(ws+fpow(2,z01)-1+MOD)%MOD;
	
	//elijo 10		//cualquier cantidad
	ws=(ws+fpow(2,z10)-1+MOD)%MOD;
	
	
	ll ans=solve(0)*ws%MOD;
	ans=(ans-1+MOD)%MOD;
	cout<<ans<<"\n";
}