#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
struct p{
    ll a, b;
    p(){}
    p(ll a, ll b):a(a),b(b){}
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll p2[200005];
int main() {
    init();
    ll N;
    cin >> N;
    vc<p> AB, A, B, E;
    ll ans = 0;
    p2[0] = 1;
    rep(i, N + 1)p2[i + 1] = 2*p2[i]%MOD;
    
    rep(i,N){
        ll a, b;
        cin >> a >> b;
        
        if(a==0 and b==0)
            AB.eb(a, b);
        else if(a==0)
            A.eb(a, b);
        else if(b==0)
            B.eb(a, b);
        else{
            ll g = gcd(abs(a), abs(b));
            a /= g, b /= g;
            if (b < 0) a *= -1, b *= -1;
            E.eb(a, b); //bは必ず正
        }
    }
    ans += AB.size();

    ll an = A.size(), bn = B.size(), abn = AB.size();

    map<pair<ll,ll>, ll> mp;
    ll en = E.size();
    rep(i,en){
        ll a = E[i].a, b = E[i].b;
        mp[{a, b}]++;
        // err(mp[{E[i].a, E[i].b}], i, E[i].a, E[i].b);
        if (a < 0) a *= -1, b *= -1;
        if (mp[{-b, a}] == 0) mp[{-b, a}] = 0;
    }



    vc<ll> ca, cb;
    repa(p, mp){
        ll a = p.first.first, b = p.first.second, acnt = p.second;
        // err(a, b, acnt);
        if (acnt == 0){
            continue;
        }
        if (a < 0) a *= -1, b *= -1;
        if(mp[{-b, a}]>0){
            ca.eb(acnt);
            cb.eb(mp[{-b, a}]);
            mp[{-b, a}] = 0;
        }else{
            ca.eb(acnt);
            cb.eb(0);
        }
    }

    ll cn = ca.size();
    vc<ll> C(cn);
    rep(i,cn){
        C[i] = (p2[ca[i]] + p2[cb[i]] - 1) % MOD;
    }

    vl seki(cn+1, 1);
    repr(i, cn)(seki[i] = seki[i + 1] * C[i]) %= MOD;

    // err(abn, an, bn, en, ans, seki);
    while(an--){
        (ans += p2[an] * seki[0] % MOD) %= MOD;
    }
    while(bn--){
        (ans += p2[bn] * seki[0] % MOD) %= MOD;
    }

    rep(i,cn){
        // err("cacb", ca[i], cb[i]);
        while(ca[i]--){
            (ans += (p2[ca[i]]) * seki[i+1] % MOD) %= MOD;
        }
        while(cb[i]--){
            (ans += (p2[cb[i]]) * seki[i+1] % MOD) %= MOD;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 40812