#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define mod 1000000007
#define ld long double
using namespace std;

ll fun(ll a, ll b)
{
	a%=mod;
	ll ans=1;
	if(a==0) ans=0;

	while(b>0)
	{
		if(b&1) ans=(ans*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}



int main()
{ 


fast;
	ll n;
	cin>>n;
	map<ld,ll > pos,neg;
	ll zero=0,inf=0,alone=0;

	ll a[n],b[n];
	for(ll i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
		if(a[i]==0 and b[i]==0)
			alone++;
		else if(a[i]==0)zero++;
		else if(b[i]==0)inf++;
		else
		{
			ll g=__gcd(abs(a[i]),abs(b[i]));
		a[i]/=g,b[i]/=g;
			ld x=(ld)1/b[i];
			//cout<<x<<" ";
			x=x*a[i];
			//cout<<x<<" "<<endl;
			if(x>0) pos[x]++;
			else neg[x]++;
		}
	}

	ll ans=(fun(2,zero)+fun(2,inf)-1+mod)%mod;
	//cout<<ans<<endl;

	
	for(auto &i:pos)
	{
		ld z=i.ff;
		z=-1/z;
		ll q=0;
		//cout<<i.ff<<" "<<z<<" "<<i.ff*z<<endl;

		if(neg.find(z)!=neg.end())
		{
			q=(fun(2,neg[z])-1 +mod)%mod;
			neg[z]=0;
		}
		//cout<<i.ff<<" "<<q<<endl;
		ll tans=(q+mod+fun(2,i.ss))%mod;
		ans=(ans*tans)%mod;
	}

	for(auto i:neg)
		if(i.ss!=0)
			ans=(ans*fun(2,i.ss))%mod;

	cout<<(ans-1+mod+alone)%mod<<endl;

}
