#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
class bunsu
{
	public:
	ll a,b;
	bool pn;
	bunsu()
	{
		a = 0;
		b= 0;
		pn = false;
	}
	bunsu(ll a,ll b,ll pn)
	{
		this->a = a;
		this->b = b;
		this->pn = pn;
	}
	bool operator<(const bunsu& value)const
	{
		if(pn!=value.pn)return pn<value.pn;
		if(value.a!=a)return a<value.a;
		return b<value.b;
	}
};

int main()
{
	ll zero = 0;
	ll n;
	cin >> n;
	map<bunsu,ll> mp;
	map<bunsu,bool> exsit;
	vector<pair<ll,ll>> AB;
	vector<bunsu> vb;
	for(ll i = 0;i<n;i++)
	{
		ll a,b;
		cin >> a >> b;
		AB.emplace_back(a,b);
		if(a==0&&b==0)
		{
			vb.emplace_back(0,0,0);
			zero ++;
			continue;
		}
		else if(a==0)
		{
			//return 1;
			vb.emplace_back(0,1,0);
			continue;
		}
		else if(b==0)
		{
			//return 1;
			vb.emplace_back(1,0,0);
			continue;
		}
		
		ll G = __gcd(abs(a),abs(b));

		vb.emplace_back(abs(a/G),abs(b/G),(a<0&&b>0)||(a>0&&b<0));
	}
	for(ll i = 0;i<n;i++)
	{
		exsit[vb[i]] = true;
		
		mp[vb[i]]++;
		mp[bunsu(vb[i].b,vb[i].a,!vb[i].pn)]+=0;
	}
	//ll ans = 1;
	ll add = 0;
	vector<ll> ANS;
	
	for(auto i:mp)
	{
		if(i.first.a==0&&i.first.b==0)
		{
			continue;
		}
		else if(i.first.a==0)
		{
			ll qwe = n - mp[bunsu(1,0,0)] - mp[bunsu(0,0,0)]-i.second;
			ll asd = mod_pow(0LL+2,i.second,MOD)-1;
			(asd *= (mod_pow(0LL+2,qwe,MOD)+MOD))%=MOD;
			//((asd -= 2)+=MOD)%=MOD;
			if(exsit[i.first])
			{
				//ANS.push_back(asd);
				//cout<<asd<<endl;
				(add += asd)%=MOD;
			}
			continue;
		}
		else if(i.first.b==0)
		{
			ll qwe = n - mp[bunsu(0,1,0)]-mp[bunsu(0,0,0)]-i.second;
			ll asd = mod_pow(0LL+2,i.second,MOD)-1;
			(asd *= (mod_pow(0LL+2,qwe,MOD)+MOD))%=MOD;
			//((asd -= 2)+=MOD)%=MOD;
			if(exsit[i.first])
			{
				//ANS.push_back(asd);
				(add += asd)%=MOD;
				//cout<<add<<endl;
				//exsit[i.first] = false;
			}
			continue;
		}
		
		bunsu alt(i.first.b,i.first.a,!i.first.pn);
		ll now =  mod_pow(0LL+2,i.second,MOD)-1;
		(now += MOD)%=MOD;
		now += mod_pow(0LL+2,mp[alt],MOD)-1;
		(now += MOD)%=MOD;
		(now +=1)%=MOD;
		if(exsit[i.first])
		{
			ANS.push_back(now);
			exsit[alt] = false;
		}
		//cout<<now<<endl;
		//cout<<mp[bunsu(i.first.b,i.first.a,!i.first.pn)]<<endl;
		//cout<<i.first.a<<' '<<i.first.b<<' '<<i.first.pn<<endl;
	}
	ll ans = 1;
	for(auto i:ANS)
	{
		(ans *= i)%=MOD;
		//cout<<ans<<';'<<i<<endl;
	}
	cout<<(ans-1LL+add+MOD+zero)%MOD<<endl;
}