#include<bits/stdc++.h>

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
const double PAI = acos(-1);
constexpr long double eps = 1e-9;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<ll> p2(200050);
    p2[0] =1;
    for(int i=1;i<200005;++i){
        p2[i] = p2[i-1]*2;
        p2[i] %= mo;
    }
    int n;
    cin>>n;
    map<pair<ll,ll>,pair<ll,ll>> m;
    int zero = 0;
    for(int i=0;i<n;++i){
        ll a,b;
        cin>>a>>b;
        if(a == 0 and b == 0) zero++;
        else if(a == 0)m[{0,0}].first++;
        else if(b == 0)m[{0,0}].second++;
        else {
            if(b < 0)a=-a,b=-b;
            int g = gcd(abs(a),abs(b));
            a/=g;
            b/=g;
            if(a < 0){
                m[{b,-a}].second++;
            }else m[{a,b}].first++;
        }
    }
    ll ret = 1;
    for(auto cur : m){
        ll now = p2[cur.second.first] + p2[cur.second.second] -1;
        (ret *= now)%=mo;
    }
    cout << ((ret + zero)%mo + mo -1)%mo << endl;
    return 0;
}
