#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

 

ll int power(ll int x, ll int y, ll int p)  
{  
    ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
 
int main()
{
  fastio();

 
ll int T;
T=1;

while(T--)
{
ll int n;
cin>>n;
ll int ans=1,cnt=0,i,x,y,zer=0,cnt1=0,cnt2=0;
set<pair<ll int,ll int>>s,s1;

map<pair<ll int,ll int>,ll int >mp;
for(i=0;i<n;i++)
{
	cin>>x>>y;
	if(x==0||y==0){cnt1++;
		continue;}
	ll int g=__gcd(abs(x),abs(y));

	x/=g;y/=g;
	if(x*y<0)
	mp[{-1*abs(x),abs(y)}]++;
	else
		mp[{abs(x),abs(y)}]++;
}

for(auto it=mp.begin();it!=mp.end();it++)
{

	
	if(mp.find({-1*it->first.second,it->first.first})==mp.end()&&mp.find({it->first.second,-1*it->first.first})==mp.end()){
		cnt+=it->second;
		
		


	}
	else
	{	if(it->first.first>0&&s.find({-1*it->first.second,it->first.first})==s.end())
		{
			ll int temp=power(2ll,it->second,1000000007)+power(2ll,mp[{-1*it->first.second,it->first.first}],1000000007)-1;
						temp%=1000000007;
						ans*=temp;
							ans%=1000000007;s.insert({it->first.first,it->first.second});}
		else if(it->first.first<0&&s.find({it->first.second,-1*it->first.first})==s.end())
		{
			ll int temp=power(2ll,it->second,1000000007)+power(2ll,mp[{it->first.second,-1*it->first.first}],1000000007)-1;
						temp%=1000000007;
						ans*=temp;
							ans%=1000000007;s.insert({it->first.first,it->first.second});

		}
	}
}


ans*=power(2,cnt,1000000007);
ans%=1000000007;
if(cnt1>0)
ans*=2;
ans%=1000000007;
ans+=1000000007-1;
ans%=1000000007;
cout<<ans<<endl;

}
    return 0;
}
