#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{
    ld a, b;
    p(){}
    p(ld a, ld 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;
        ll g = gcd(a, b);
        a /= g, b /= g;
        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
            E.eb(a, b);
    }
    ans += AB.size();

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

    map<ld, ll> mp;
    ll en = E.size();
    rep(i,en){
        mp[E[i].a / E[i].b]++;
    }


    // repa(p, mp) err(p.first, p.second);

    vc<ll> ca, cb;
    repa(p, mp){
        ld a = p.first;
        ll acnt = p.second;
        if (acnt == 0) continue;
        ld d = -1.0L / a;
        if(mp[d]>0){
            ca.eb(acnt);
            cb.eb(mp[d]);
            mp[d] = 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;
    }

    ll seki = 1;
    rep(i, cn)(seki *= C[i]) %= MOD;

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

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

    cout << ans << endl;
}
