#include <bits/stdc++.h>

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

ll modpow(ll N, ll P,ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t =modpow(N, P/2,M);
        return t*t % M;
    }
    return N * modpow(N, P-1, M)%M;
}

int main(){
    ll n;cin >>n;
    map<P,ll>mp;
    for (int i = 0; i < n; ++i) {
        ll a,b;cin >>a>>b;
        if(a==0&&b==0){
            mp[{0,0}]++;
            continue;
        }
        ll g=__gcd(a,b);
        a/=g;b/=g;
        if(a<0){
            a*=-1;b*=-1;
        }
        if(a==0){
            if(b>0)b*=-1;
        }
        mp[{a,b}]++;
    }
    ll ans=1;
    for(auto p:mp){
        if(p.second==0)continue;
        if(p.first.first==0&&p.first.second==0){
            continue;
        }
        if(p.first.second<0){
            if(mp[{-p.first.second,p.first.first}]!=0)continue;
        }
        ll r = modpow(2, p.second, mod) - 1;
        r += modpow(2, mp[{p.first.second, -p.first.first}], mod) - 1;
        r %= mod;
        r++;
//        cout <<r<<endl;
        ans *= r;
        ans %= mod;
    }
    ans+=mp[{0,0}]%mod;
    ans--;
    cout <<ans <<endl;
    return 0;
}

