#include<bits/stdc++.h>

using namespace std;
using ll = long long int;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    map<pair<ll,ll>,ll> mp;

    auto powmod = [&](ll a, ll b) -> ll {
        ll r = 1;
        while(b) {
            if(b&1) (r *= a) %= MOD;
            (a *= a) %= MOD;
            b >>= 1;
        }
        return r % MOD;
    };

    for(ll i=0; i<n; i++) {
        ll a, b;
        cin >> a >> b;
        ll g = __gcd(a, b);
        a /= g, b /= g;
        if(b < 0) a *= -1, b *= -1;
        mp[{a,b}]++;
    }

    set<pair<ll,ll>> st;

    ll res = 1;
    for(auto [t, cnt]: mp) {
        auto [a, b] = t;
        if(st.count({a,b})) continue;

        ll tmp = 0;
        tmp += powmod(2, cnt);
        ll ta = -b, tb = a;
        if(tb < 0) ta *= -1, tb *= -1;
        if(mp.count({ta,tb}))
            tmp += powmod(2, mp[{ta,tb}]), tmp--;

        tmp %= MOD;
        (res *= tmp) %= MOD;

        st.insert({a,b});
        st.insert({ta,tb});
    }

    cout << (MOD-1 + res)%MOD << endl;
}
