#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,a[maxn],b[maxn],cnt=1,B[maxn],ans;
const ll mod=1000000007;
struct node{ll x,y;}p[maxn];

inline bool operator < (node a,node b)
{
	if(a.x==b.x) return a.y<b.y;
	return a.x<b.x;
}

map <node,ll> mp,q;

inline ll M(ll a,ll b){return (a%mod*b%mod)%mod;}

int main()
{
	n=read(); B[0]=1; ans=1;
	rep(i,1,n) B[i]=(B[i-1]*2)%mod;
	rep(i,1,n)
	{
		a[i]=read(),b[i]=read();
		if(a[i]==0&&b[i]==0) {cnt++; continue;}
		ll tmp=__gcd(a[i],b[i]);
		a[i]/=tmp; b[i]/=tmp; if(a[i]<0) a[i]=-a[i],b[i]=-b[i];
		mp[{a[i],b[i]}]++; q[{a[i],b[i]}]++;
		//cout<<a[i]<<" "<<b[i]<<endl;
	}
	for(map <node,ll>::iterator it=mp.begin();it!=mp.end();it++)
	{
		pair <node,ll> tmp=*it;
		ll tx=tmp.first.x,ty=tmp.first.y;
		if(ty<=0)
		{
			if(q[{-ty,tx}]);
			else ans=M(ans,B[tmp.second]);
			//cout<<ans<<endl;
			continue;
		}
		ll p2=mp[{ty,-tx}],p1=tmp.second;
		if(p1==0||p2==0) ans=M(ans,M(B[p1],B[p2]));
		else ans=M(ans,(B[p1]+B[p2]-1)%mod);
		//cout<<ans<<endl;
	}
	cout<<(M(ans,cnt)-1+mod)%mod<<endl;
	return 0;
}