#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const int lmod = 1000000007;
inline pll inv(pll p)
{
	return pll(p.second,-p.first);
}
ll modpow(ll a, ll b)
{
	if(b==0)
		return 1;
	ll f = modpow(a,b/2);
	f = (f*f)%lmod;
	if(b&1)
		f=(f*a)%lmod;
	return f;
}
ll gcd(ll a, ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<pll> v(n);
	map<pll, vector<pll>> m1,m2;
	pll p;
	ll vv=0;
	for(auto& p:v)
	{
		cin>>p.first>>p.second;
		if(p.first==0 && p.second==0)
		{
			vv++;
			continue;
		}
		if(p.first<0)
		{
			p.first*=-1;
			p.second*=-1;
		}
		if(p.second>0)
		{
			ll g = __gcd(abs(p.first),abs(p.second));
			auto q = pll(p.first/g,p.second/g);
			m1[q].push_back(p);
		}
		else
		{
			ll g = __gcd(abs(p.first),abs(p.second));
			auto q = pll(p.first/g,p.second/g);
			m2[q].push_back(p);
		}
	}
	ll ans=1;
	for(auto& it:m1)
	{
		p = it.first;
		ll mul = modpow(2,(it.second).size());
		auto q = inv(p);
		if(m2.find(q)!=m2.end())
		{
			mul = mul + modpow(2,m2[q].size()) - 1;
			m2.erase(q);
		}
		mul%=lmod;
		ans = ans*mul;
		ans%=lmod;
	}
	for(auto& it:m2)
	{
		ll mul = modpow(2,(it.second).size());
		ans = ans*mul;
		ans%=lmod;
	}
	ans = (ans+vv)%lmod;
	ans = (ans-1)%lmod;
	if(ans<0)
		ans+=lmod;
	cout<<ans<<"\n";
}