#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll mod=1e9+7;
ll power(ll a,ll b)
{
    ll result=1;
    while(b>0)
    {
        if(b%2==1)
        {
            result=(result*a)%mod;   
        }
        b/=2;
        a=(a*a)%mod;
    }
    return result;
}
int main()
{
    
    vector<ll> powe(3e5,0);
    powe[0]=1;
    for(int i=1;i<3e5;i++)
    {
        powe[i]=(powe[i-1]*2)%mod;
    }
    int n;
    cin>>n;
    vector<pair<ll,ll> > a(n);
    map<pair<ll,ll>,int> m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].first>>a[i].second;
       
        ll p=__gcd(a[i].first,a[i].second);
        a[i].first/=p;
        a[i].second/=p;
         if(a[i].first>0&&a[i].second<0)
        {
            a[i].first=-a[i].first;
            a[i].second=-a[i].second;
        }
        if(a[i].second<0&&a[i].first<0)
        {
            a[i].second=-a[i].second;
            a[i].first=-a[i].first;
        }
        m[a[i]]++;
    }
    ll ans=1;
    // cout<<endl;
    for(auto it:m)
    {
        // cout<<it.first.first<<" "<<it.first.second<<endl;
        if(it.first.first<0)
        {
            if(m.find({it.first.second,-it.first.first})==m.end())
            ans=(ans*(it.second+1))%mod;
            // cout<<ans<<endl;
            continue;
        }
        ll p=it.second;
        ll q=0;
        if(m.find({-it.first.second,it.first.first})!=m.end());
        {
            q=m[{-it.first.second,it.first.first}];
        }
       
        ll res=(powe[p]-1+powe[q]-1)%mod;
        ans=(ans*(res+1))%mod;
        // cout<<ans<<endl;
    }
    cout<<ans-1<<endl;
    
}