#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+45;
const int mod = 1000000007;

ll n,a[N],b[N];
map <pair<ll,pair<ll,ll>>,ll> mapa,uradijo;

ll fp(ll x,ll y){
    if(y == 0){
        return 1;
    }
    ll p = fp(x,y/2);
    p = (p*p)%mod;
    if(y&1){
        p = (p*x)%mod;
    }
    return p;
}

ll minv(ll x){
    return fp(x,mod-2);
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    ll nule = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
        if(a[i] == 0 && b[i] == 0){
            nule++;
        }
        else{
            ll znak = (a[i] > 0 ? 1 : -1)*(b[i] > 0 ? 1 : -1);
            a[i] = abs(a[i]),b[i] = abs(b[i]);
            ll g = __gcd(a[i],b[i]);
            a[i] /= g;
            b[i] /= g;
            mapa[{znak,{a[i],b[i]}}]++;
        }
    }
    //cout << "staa" << endl;
    ll sol = 1;
    for(auto f : mapa){
        if(uradijo[f.first]){
            continue;
        }
        auto ob = make_pair(-f.first.first,make_pair(f.first.second.second,f.first.second.first));
        uradijo[f.first] = uradijo[ob] = 1;
        ll ima = mapa[ob];
        //cout << f.first.first << " " << f.first.second.first << " " << f.first.second.second << " ima " << f.second << " a ob " << ima << endl;
        ll dod = (fp(2,f.second)+fp(2,ima)-1)%mod;
        if(dod < 0){
            dod += mod;
        }
        //cout << "Staa" << dod << endl;
        sol = (sol*dod)%mod;
    }
    sol = (sol-1)%mod;
    if(sol < 0){
        sol += mod;
    }
    sol = (sol+nule)%mod;
    cout << sol << endl;
}
