
/*
	*	Created By: 'Present_Sir'
	*	Created On: Saturday 22 August 2020 01:41:32 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(v) v.begin(),v.end()
#define int long long
#define float long double
using namespace std;
const int mod = (int)1e9 + 7;

int mul(int a, int b){
    return (a*b)%mod;
}

void solve(){
    int n;
    cin>>n;
    
    vector < int > po(n+1,1);

    for(int i=1; i<=n; ++i){
        po[i] = (po[i-1]*2)%mod;
    }

    map < pair<int, int> , int > mp;

    for(int i=0; i<n; ++i){
        int a,b;
        cin>>a>>b;
        int gc = __gcd(a,b);
        //cout<<gc<<endl;
        int va = a/gc;
        int vb = b/gc;
        if(vb<0){
            va *= -1;
            vb *= -1;
        }
        mp[{ va, vb }]++;
        //cout<<va<<" "<<vb<<endl;
    }
    
    map < pair < int, int > , int > vis;
    int ans = 1;
    for(auto x: mp){
        //cout<<"Cur: "<<x.first.first<<endl;
        if(vis.count(x.first)){
            //cout<<endl;
            continue;
        }
        int a = x.first.first;
        int b = x.first.second;
        int val = x.second;
        //  a &&  b
        // bad -> ( -a && b ) || (a && -b) 
        if(mp.count({-b,a})){
            //cout<<"First :" <<-a<<" "<<b<<endl;
            pair < int, int > p = {-b,a};
            vis[p]++;
            int val2 = mp[p];
            //cout<<val<<" "<<val2<<endl;
            int curAns = (po[val+val2]-(val*val2)%mod+mod)%mod;
            //cout<<curAns<<" "<<po[val+val2]<<endl;
            ans *= curAns;
            ans %= mod;
            continue;
        }
        if(mp.count({b,-a})){
            //cout<<"Second: "<<-a<<" "<<b<<endl;
            pair < int, int > p = {b,-a};
            vis[p]++;
            int val2 = mp[p];
            //cout<<val<<" "<<val2<<endl;
            int curAns = (po[val+val2]-(val*val2)%mod+mod)%mod;
            //cout<<curAns<<" "<<po[val+val2]<<endl;
            ans *= curAns;
            ans %= mod;
            continue;
        }

        ans *= po[val];
        ans %= mod;
    }
    --ans;
    //for(auto x: vis){
        //cout<<x.first.first<<endl;
    //}
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}

