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

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