#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long ll;
const int MOD=1e9+7;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    ll n;cin>>n;
    ll a[200020],b[200020];
    ll zero=0;
    map<double> m1,m2;
    rep(i,0,n){
        cin>>a[i]>>b[i];
        if(a[i]==0&&b[i]==0){
            zero++;
            a[i]=2e18;b[i]=2e18;
        }
        else if(a[i]==0)m1[0]++;
        else if(b[i]==0)m2[0]++;
    }
    ll an;
    
    an=(m1[0]*(modpow(2,m2[0],MOD)-1)%MOD)*(modpow(2,n-1-zero-m2[0],MOD))%MOD;
    
    rep(i,0,n){
        if(a[i]*b[i]==0)continue;
        m1[(double)a[i]/b[i]]++;
        m2[(double)b[i]/a[i]]++;
    }
    for(auto p:m1){
        an+=(p.second*(modpow(2,m2[p.first],MOD)-1)%MOD)*(modpow(2,n-1-zero-m2[p.first],MOD))%MOD;
    }
    an+=zero+MOD;
    an=an%MOD;
    cout<<an<<endl;
}

    







