#include<bits/stdc++.h>

using namespace std;

#define LL long long
#define N 200005
#define mod 1000000007

LL ans, a[N], b[N], _gcd, p, q;
int n, cur, T, i, r, vis[N];
map<pair<LL,LL>, int> K;
pair<LL,LL> Q[N];
pair<pair<LL,LL>, int> label[N];

LL power(LL x,int y)
{
	LL t=1;
	for (; y; y>>=1) {
		if (y&1) t=t*x%mod;
		x=x*x%mod; 
	}
	return t;
}

int main (void)
{
	scanf("%d",&n);
	for (i=1; i<=n; i++) {
		scanf("%lld%lld",&a[i],&b[i]);
		if (a[i]<0) a[i]=-a[i],b[i]=-b[i];
		if (!a[i]||!b[i]) continue;
		_gcd=__gcd(abs(a[i]),abs(b[i]));
		a[i]/=_gcd,b[i]/=_gcd;
		Q[i]=make_pair(a[i],b[i]);
	}	
	sort(Q+1,Q+n+1);
	cur=T=1;
	for (i=2; i<=n; i++) {
		if (Q[i].first==Q[i-1].first&&Q[i].second==Q[i-1].second) cur++;
		else label[T]=make_pair(Q[i-1],cur),T++,cur=1;
	}
	if (cur) label[T]=make_pair(Q[i-1],cur);
	for (i=1; i<=T; i++) K[label[i].first]=i;
	ans=1;
	for (i=1; i<=T; i++) {
		if (vis[i]) continue;
		p=-label[i].first.second; q=label[i].first.first;
		if (!p&&!q) continue;
		if (p<0) p=-p,q=-q;
		_gcd=__gcd(abs(p),abs(q));
		p/=_gcd,q/=_gcd;
		r=K[make_pair(p,q)];
		if (r) {
			ans=ans*(power(2LL,label[i].second)+power(2LL,label[r].second)-1)%mod;
			if (ans<0) ans+=mod;
			vis[i]=vis[r]=1;
		}
		else {
			ans=ans*power(2LL,label[i].second)%mod;
			vis[i]=1;
		}
		//printf("%lld %d\n",ans,T);
	}
	ans=(ans-1)%mod;
	if (ans<0) ans+=mod;
	ans=(ans+K[make_pair(0,0)])%mod;
	printf("%lld\n",ans);
	return 0;
}