#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=1000 * 1000 * 1000 + 7;
ll mul(ll a, ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a, ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll sub(ll a, ll b)
{
	return ((a%mod)-(b%mod)+mod)%mod;
}
ll po[200005];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	po[0]=1;
	for(ll i=1;i<200005;i++)
	{
		po[i]=mul(po[i-1],2);
	}
	map<pair<ll,ll>,pair<ll,ll>> m;
	ll a=mod-1;
	while(n--)
	{
		ll x,y;
		cin>>x>>y;
		if(x==0 && y==0)
		{
			a++;
			continue;
		}
		if(x==0 || y==0)
		{
			if(x==0)
			{
				m[make_pair(1,0)].first+=1;
			}
			else
			{
				m[make_pair(1,0)].second+=1;
			}
			continue;
		}
		if(x*y>0)
		{
			ll g=__gcd(abs(x),abs(y));
			x=abs(x)/g;
			y=abs(y)/g;
			m[make_pair(x,y)].first+=1;
		}
		else
		{
			ll g=__gcd(abs(x),abs(y));
			x=abs(x)/g;
			y=abs(y)/g;
			m[make_pair(y,x)].second+=1;
		}
	}
	ll r=1;
	for(auto it=m.begin();it!=m.end();it++)
	{
		pair<ll,ll> p=it->second;
		
		r=mul(r,sub(add(po[p.first],po[p.second]),1));
	}
	
	r=add(a,r);
	cout<<r;
}
