#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000


ll powe(ll a, ll b){//aのb乗のmod
    ll ret = 1;
    while(0 < b){
        if((b%2) == 0){
            a = (a*a)%MOD;
            b >>= 1;
        }
        else{
            ret = (ret*a)%MOD;
            b--;
        }
    }
    return ret;
}

int main(){
    ll n; double a, b, y, z; cin >> n;
    ll bothz = 0; ll az = 0; ll bz = 0;
    vector<double> as;
    vector<double> bs;
    REP(i,n){
        cin >> a >> b;
        if (a==0&&b==0){
            bothz++;
        }
        else if (a==0){
            az++;
        }
        else if (b==0){
            bz++;
        }
        else{
            y = a/b;
            z = b/a;
            as.pb(y);
            bs.pb(z);
            //cout << y << " " << z << endl;
        }
    }
    sort(as.begin(),as.end());
    sort(bs.begin(),bs.end());
    //REP(i,as.size()) cout << as[i] << " " << bs[i] << endl;
    ll ans = 1;
    ll i = 0;
    vector<ll> reached(as.size(),0);
    while (i<as.size()){
        if (reached[i]==0){
            double x = -as[i];
            ll ind1 = lower_bound(bs.begin(),bs.end(),x)-bs.begin();
            ll ind2 = upper_bound(bs.begin(),bs.end(),x)-bs.begin();
            if (ind1==ind2){
                ans = (ans*2)%MOD;
                //cout << i << " " << 2 << endl;
                i++;
            }
            else{
                ll ind3 = lower_bound(as.begin(),as.end(),-x)-as.begin();
                ll ind4 = upper_bound(as.begin(),as.end(),-x)-as.begin();
                ans = (ans*((powe(2,ind2-ind1)+powe(2,ind4-ind3)-1))%MOD))%MOD;
                //cout << i << " " << ind1 << " " << ind2 << " " << ind3 << " " << ind4 << endl;
                ll ind5 = lower_bound(as.begin(),as.end(),1/x)-as.begin();
                ll ind6 = upper_bound(as.begin(),as.end(),1/x)-as.begin();
                for(ll j=ind5;j<ind6;j++) reached[j]=1;
                i = ind4;
            }
        }
        else{
            i++;
        }
    }
    ans=(ans*((powe(2,az)+powe(2,bz)-1)%MOD))%MOD;
    ans=(ans-1)%MOD;
    cout << ans << endl;
}