#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

ll MD=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	map< pll , ll >POS,NEG;
	map< pll , bool >DONE;
	ll ans=0,AZ=0,BZ=0;
	cin >> n;
	for(i=1;i<=n;i++)
	{
		cin >> x >> y;
		ll f=0;
		if( (y<0 && x>0) || (y>0 && x<0) )
		{
			// cout<<x<<"reh"<<y<<endl;
			f=1;
		}

		x=abs(x),y=abs(y);


		if(x && y)
		{
			ll g=__gcd(x,y);
			x/=g,y/=g;

			if(f)
			{
				if(NEG.find(mp(x,y))==NEG.end())
					NEG[mp(x,y)]=1;
				else
					NEG[mp(x,y)]++;
			}
			else
			{
				// cout<<x<<"rg"<<y<<" "<<i<<endl;
				if(POS.find(mp(x,y))==POS.end())
					POS[mp(x,y)]=1;
				else
					POS[mp(x,y)]++;
			}
		}
		else
		{
			if(x==0 && y==0)
				ans+=1,ans%=MD;
			else
			{
				if(!x)
					AZ++;
				else
					BZ++;
			}
		}
	}

	x=(power(2,AZ,MD)-1+MD)%MD;
	y=(power(2,BZ,MD)-1+MD)%MD;

	ll g=(x+y+1)%MD;

	for(auto it:POS)
	{
		pll P=it.ff;
		swap(P.ff,P.ss);
		ll gg;
		if(NEG.find(P)==NEG.end())
			gg=0;
		else
			gg=NEG[P],DONE[P]=true;



		x=(power(2,it.ss,MD)-1+MD)%MD;
		y=(power(2,gg,MD)-1+MD)%MD;

		ll h=(x+y+1)%MD;
		g=(g*h)%MD;
	}

	for(auto it:NEG)
	{
		if(DONE.find(it.ff)!=DONE.end())
			continue;
		pll P=it.ff;
		swap(P.ff,P.ss);
		ll gg;
		if(POS.find(P)==POS.end())
			gg=0;
		else
			gg=POS[P];

		x=(power(2,it.ss,MD)-1+MD)%MD;
		y=(power(2,gg,MD)-1+MD)%MD;

		// cout<<x<<" "<<gg<<endl;
		ll h=(x+y+1)%MD;
		g=(g*h)%MD;
	}

	g=(g-1)%MD;

	g=(g+ans)%MD;
	cout<<g<<endl;	
}