#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, ans = 0, zeros = 0;
    vector<ll> pairs;
    cin >> n;
    map<P, ll> m;
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        if(a == 0 && b == 0) {
            zeros++;
        }
        else if(a == 0) {
            b = 1;
            P tmp = make_pair(a,b);
            if(m.count(tmp)) m[tmp]++;
            else m[tmp] = 1;
        }
        else if(b == 0) {
            a = 1;
            P tmp = make_pair(a,b);
            if(m.count(tmp)) m[tmp]++;
            else m[tmp] = 1;
        }
        // 一般形にする
        else {
            if(a < 0) {
                a *= -1;
                b *= -1;
            }
            ll plus = my_abs(b);
            ll div = my_gcd(a, plus);
            a /= div;
            b /= div;
            P tmp = make_pair(a,b);
            if(m.count(tmp)) m[tmp]++;
            else m[tmp] = 1;
        }
    }
    set<P> se;
    for(auto p: m) {
        auto key = p.first;
        auto value = p.second;
        if(se.count(key)) continue;
        ll tmp;
        P bad;
        // どちらか0の時は区別
        if(key.first == 0) {
            bad = make_pair(1,0);
            if(m.count(bad)) {
                tmp = a_n(2, value) + a_n(2, m[bad]) - 1;
                tmp %= MOD;
                pairs.push_back(tmp);
            }
            else {
                tmp = a_n(2, value);
                tmp %= MOD;
                pairs.push_back(tmp);
            }
        }
        else if(key.second == 0) {
            bad = make_pair(0,1);
            if(m.count(bad)) {
                tmp = a_n(2, value) + a_n(2, m[bad]) - 1;
                tmp %= MOD;
                pairs.push_back(tmp);
            }
            else {
                tmp = a_n(2, value);
                tmp %= MOD;
                pairs.push_back(tmp);
            }
        }
        else {
            if(key.second < 0) {
                bad = make_pair(-1*key.second, key.first);
            }
            else {
                bad = make_pair(key.second, -1*key.first); 
            }
            if(m.count(bad)) {
                tmp = a_n(2, value) + a_n(2, m[bad]) - 1;
                tmp %= MOD;
                pairs.push_back(tmp);
            }
            else {
                tmp = a_n(2, value);
                tmp %= MOD;
                pairs.push_back(tmp);
            }
        }
        se.insert(bad);
        se.insert(key);
    }
    ans = 1;
    rep(i, pairs.size()) {
        ans *= pairs[i];
        ans %= MOD;
    }
    cout << (ans-1+zeros+MOD)%MOD << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count))%MOD;
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 42296