#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;
const int MAX=200001;
int 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;
    }
}

int 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;
}

int powMOD(int n,int r){
    if(r<=0)return 1;
    if(r%2==0)return powMOD(n,r/2)*powMOD(n,r/2)%MOD;
    if(r%2==1)return powMOD(n,r-1)*n%MOD;
}

signed main(){
    int N;cin>>N;
    pair<int,int> X[N];
  	REP(i,N)X[i]={INF,INF};
    map<pair<int,int>,int>umemo;
    map<pair<int,int>,int>smemo;
  	int Ac=0,Bc=0;
    int cc=0;
    REP(i,N){
        int a,b;cin>>a>>b;
      	if((a==0)||(b==0)){
          	if(a==0&&b==0){
                cc++;
              	continue;
            }
          	if(a==0)Ac++;
          	if(b==0)Bc++;
        }
        int x=__gcd(a,b);
        a/=x;
        b/=x;
        X[i]={a,b};
        umemo[{a,b}]++;
        smemo[{-b,a}]++;
    }
    int ans=1;
    REP(i,N){
      	if(X[i].first==INF)continue;
        if(umemo[X[i]]==0)continue;
        int d=0;
        if(smemo[X[i]]==0){
            d=powMOD(2,umemo[X[i]]);
        }
        else{
          	d=-1;
            d=(d+powMOD(2,umemo[X[i]]))%MOD;
            d=(d+powMOD(2,smemo[X[i]]))%MOD;
        }
      	while(d<0)d+=MOD;
		ans=ans*d%MOD;
        umemo[X[i]]=0;
        int a=X[i].first;
        int b=X[i].second;
        umemo[{b,a}]=0;
    }
    if(Ac==0||Bc==0){
        ans=ans*(powMOD(2,max(Ac,Bc)))%MOD;
    }
    else{
  	    int d=-1;
  	    d=(d+powMOD(2,Ac)%MOD);
        d=(d+powMOD(2,Bc)%MOD);
        ans=ans*d%MOD;
    }   
  	ans--;
    ans+=cc;
    while(ans<0)ans+=MOD;
    cout<<ans<<endl;
}