#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 my2POW(int r) {
    ll ans = 1;
    rep(i, r) {
        ans = ans * 2 % MOD;
    }
    return ans;
}

int main() {
    map<pair<ll,ll>,pair<int,int>> 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;
            }
            pair<ll,ll> p1;
            if(B < 0) {
                pair<ll,ll> p1 = make_pair(-B,A);
                if(mp.find(p1) != mp.end()) {
                    mp.at(p1).second++;
                } else {
                    mp.insert(make_pair(p1,make_pair(0,1)));
                }
            } else {
                pair<ll,ll> p2 = make_pair(A,B);
                if(mp.find(p2) != mp.end()) {
                    mp.at(p2).first++;
                } else {
                    mp.insert(make_pair(p2,make_pair(1,0)));
                }
            }
        }
    }

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