#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; ll a, b, gcdab, y, z; cin >> n;
    ll bothz = 0; ll az = 0; ll bz = 0;
    vector<vector<ll>> as;
    REP(i,n){
        cin >> a >> b;
        if (a==0&&b==0){
            bothz++;
        }
        else if (a==0){
            az++;
        }
        else if (b==0){
            bz++;
        }
        else{
            gcdab = __gcd(a,b);
            a/=gcdab;
            b/=gcdab;
            if ((a<0&&b<0)||(a<0&&b>0)){
                a=-a;
                b=-b;
            }
            as.pb({a,b});
        }
    }
    sort(as.begin(),as.end());
    ll pp = as.size();
    ll ans = 1;
    ll i = 0;
    ll cnt = 0;
    vector<ll> reached(as.size(),0);
    vector<ll> bs;
    vector<ll> cs;
    REP(i,as.size()){
        bs.pb(as[i][0]);
        cs.pb(as[i][1]);
    }
    while (i<pp){
        if (reached[i]==0){
            cnt++;
            if (as[i]==as[i+1]){
                i++;
            }
            else{
                ll seb, sec;
                if (bs[i]>0&&cs[i]>0){
                    seb = cs[i];
                    sec = -bs[i];
                }
                else{
                    seb = -cs[i];
                    sec = bs[i];
                }
                ll ind1 = lower_bound(bs.begin(),bs.end(),seb)-bs.begin();
                ll ind2 = upper_bound(bs.begin(),bs.end(),seb)-bs.begin();
                ll ind3 = lower_bound(cs.begin()+ind1,cs.begin()+ind2,sec)-cs.begin();
                ll ind4 = upper_bound(cs.begin()+ind1,cs.begin()+ind2,sec)-cs.begin();
                for(ll j=ind3;j<ind4;j++) reached[j]=1;
                ans = (ans*((powe(2,cnt)+powe(2,ind4-ind3)-1)%MOD))%MOD;
                i++;
                cnt=0;
            }
        }
        else{
            i++;
        }
    }
    ans=(ans*((powe(2,az)+powe(2,bz)-1)%MOD))%MOD;
    ans=(ans+bothz-1)%MOD;
    cout << ans << endl;
}