#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
#include<numeric>//gcd
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

/*ここから*/
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*ここまで*/
/*ここから*/
LL Euclid(LL a,LL b){
    while(1){
        if(a<b){int c=a;a=b;b=c;}
        if(a%b==0){return b;}
        else{a=a%b;}
    }
}
/*ここまで*/


int main()
{ 
    COMinit();
    LL n;
    cin>>n;
    vector<P> a;
    vector<P> b;
    vector<P> a2;
    vector<P> b2;
    vector<P> c;
    vector<P> d;
    vector<P> e;

    LL pow[n+1];
    for(int i=0;i<=n;i++){
        if(i==0){pow[i]=1;}
        else{pow[i]=(pow[i-1]*2)%MOD;}
    }
    for(int i=0;i<n;i++){
        LL A,B;
        cin>>A>>B;
        if(A>0&&B>0){a2.push_back(P(A,B));}
        if(A==0&&B>0){c.push_back(P(A,B));}
        if(A<0&&B>0){b2.push_back(P(-A,B));}
        if(A>0&&B==0){d.push_back(P(A,B));}
        if(A==0&&B==0){e.push_back(P(A,B));}
        if(A<0&&B==0){d.push_back(P(A,B));}
        if(A>0&&B<0){b2.push_back(P(A,-B));}
        if(A==0&&B<0){c.push_back(P(A,B));}
        if(A<0&&B<0){a2.push_back(P(-A,-B));}
    }
    LL ans2=COM(e.size(),2)%MOD;
    ans2=(ans2+(e.size()*(n-e.size()))%MOD)%MOD;
    ans2=(ans2+(c.size()*d.size())%MOD)%MOD;

    LL ans=1;
    for(int i=0;i<a2.size();i++){
        P p=a2[i];

        LL A2=p.first;
        LL B2=p.second;
        LL f=0;
        LL D=gcd<LL,LL>(p.first,p.second);
        /*while(f==0){
            if(A2<B2){int C2=A2;A2=B2;B2=C2;}
            if(A2%B2==0){D=B2;f=1;}
            else{A2=A2%B2;}
        }*/
        //D=1;//Euclid(p.first,p.second);
        a.push_back(P(p.first/D,p.second/D));
    }
    for(int i=0;i<b2.size();i++){
        P p=b2[i];

        LL A2=p.first;
        LL B2=p.second;
        LL D=gcd<LL,LL>(p.first,p.second);
        LL f=0;
        /*while(f==0){
            if(A2<B2){int C2=A2;A2=B2;B2=C2;}
            if(A2%B2==0){D=B2;f=1;}
            else{A2=A2%B2;}
        }*/
        //D=1;Euclid(p.first,p.second);
        b.push_back(P(p.second/D,p.first/D));
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    a.push_back(P(1000000000000000000,1000000000000000000));
    b.push_back(P(1000000000000000001,1000000000000000001));
    LL cnta=0;
    LL cntb=0;
    LL cntA=0;
    LL cntB=0;
    LL flg=0;
    P mem;
    LL Sa=a.size();
    LL Sb=b.size();
    while(cnta<Sa&&cntb<Sb){
        if(a[cnta]<b[cntb]&&flg==0){cnta++;if(cnta<Sa){ans=(ans*2)%MOD;}}
        else if(a[cnta]>b[cntb]&&flg==0){cntb++;if(cntb<Sb){ans=(ans*2)%MOD;}}
        else if(a[cnta]==b[cntb]&&flg==0){cntA=1;cntB=0;flg=1;mem=a[cnta];cnta++;}
        else if(a[cnta]==b[cntb]&&flg!=0){cntA++;cnta++;}
        else if(a[cnta]!=b[cntb]&&flg!=0){
            if(b[cntb]==mem){cntB++;cntb++;}
            else{flg=0;
                LL k=pow[cntA];
                LL k2=pow[cntB];
                ans=(ans*(k+k2-1))%MOD;}
        }
        else{cnta++;cntb++;}
    }
   /* LL k=pow[c.size()];
    LL k2=pow[d.size()];
    ans=(ans*(k+k2-1))%MOD;
    ans=(ans-1+e.size())%MOD;*/
    cout<<ans-1<<endl;
    return 0;
}