#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define MOD 1000000007LL

ll pow2(int r) {
    ll ans = 1, a = 2;
    while(r > 0) {
        if(r & 1) ans = ans * a % MOD;
        a = 2 * 2 % MOD;
        r >>= 1;
    }
    return ans;
}

int main() {
    map<pair<ll,ll>,pair<ll,ll>> mp;
    int N;
    cin >> N;
    ll count = 0;
    rep(i, N) {
        ll A, B;
        cin >> A >> B;
        if(A == 0 && B == 0) {
            count = (count + 1) % MOD;
        } else {
            ll g = __gcd(A,B);
            A /= g; B /= g;
            if(A < 0) { B *= -1; A *= -1; }
            if(B < 0) mp[{-B,A}].second++;
            else mp[{A,B}].first++;
        }
    }

    ll ans = 1;
    for(auto p : mp) {
        ans = ans * ((pow2(p.second.first) + pow2(p.second.second) - 1 + MOD) % MOD) % MOD;
    }    
    ans = (ans + (pow2(count) - 1) + MOD) % MOD;
    
    cout << ans - 1 << endl;
}