#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

ll pow2(ll n){
    ll r=1;
    REP(i,0,n){
        r*=2;
        r%=mod;
    }
    return r;
}

int main(){
    ll N=ii();
    ll zz=0;
    map<pii,ll> m;
    REP(i,0,N){
        ll a=ii();
        ll b=ii();
        if(a==0&&b==0){
            zz++;
            continue;
        }
        if(a<0){
            a=-a; b=-b;
        }
        ll g = gcd(a,b);
        a/=g; b/=g;
        m[{a,b}]++;
    }

    ll ret=1;
    for(auto [p,c]:m){
        auto [a,b]=p;
        ll cc;
        if(b<0){
            cc=m[{-b,a}];
            m.erase({-b,a});
        }else{
            cc=m[{b,-a}];
            m.erase({b,-a});
        }
        ret *= (pow2(c)-1)+(pow2(cc)-1)+1; 
        ret %= mod;
    }
    oie((ret + zz -1)%mod);

    return 0;
}