#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll powr(ll a,ll b, ll mod)
{
	if(b<=0)
		return 1;
	else if(b%2==0)
		return (powr(a,b/2,mod)*powr(a,b/2,mod))%mod;
	else
		return (a*powr(a,b-1,mod))%mod;
}

void solve()
{
	ll n;
	cin>>n;
	ll mod = 1000000007;
	ll a[n], b[n];
	vector<double> q,w;
	map<string,ll> m1,m2;
	ll k1 = 0; ll k2 = 0;
	ll az = 0;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i];
		if(a[i]!=0&&b[i]!=0)
		{
			ll g = __gcd(abs(a[i]),abs(b[i]));
			if((double)a[i]/b[i]>0)
			{
				// cout<<"lhelj"<<endl;
				// q.push_back((double)a[i]/b[j]);
				m1[to_string(a[i]/g)+"/"+to_string(b[i]/g)]++;
			}
			else
			{
				// cout<<"lsjdlfjj"<<endl;
				// w.push_back(-1*(double)a[i]/b[i]);
				m2[to_string(-abs(a[i])/g)+"/"+to_string(abs(b[i])/g)]++;
			}
		}
		if(a[i]==0&&b[i]==0)
			az++;
		else if(a[i]==0)
			k1++;
		else if(b[i]==0)
			k2++;
	}
	ll ans = (powr(2,k1,mod) + powr(2,k2,mod)-1+mod)%mod;
	// ans = (ans + powr(2,n-az-k1) - powr(2,n-az-k2-k1));
	for(auto i: m1)
	{
		// cout<<i.first<<" "<<i.second<<endl;
		ll e1 = i.second;
		ll idx = i.first.find("/");
		string ts = i.first.substr(idx+1,i.first.length()-idx-1);
		ts += "/"+i.first.substr(0,idx);
		ll e2 = m2["-"+ts];
		// cout<<e1<<" "<<e2<<endl;
		m2.erase("-"+ts);

		ans = (ans*(powr(2,e2,mod) + powr(2,e1,mod)-1+mod))%mod;
		// ans = (ans + powr(2,n-az-k1) - powr(2,n-az-k2-k1));
	}
	for(auto i: m2)
	{
		// cout<<i.first<<endl;
		ans = (ans*(powr(2,i.second,mod)))%mod;
	}
	cout<<(ans+az-1+mod)%mod<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}