#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

ll MOD = 1000000007;

vector<ll> mfact(1,1);

ll extGCD(ll a, ll b, ll &x, ll &y){
    if(b == 0){
        x = 1;
        y = 0;
        return a;
    }
    ll g = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return g;
}

ll minv(ll a){
    ll x;ll y;
    extGCD(a, MOD, x, y);
    if(x<0){
        x+= ((-x)/MOD+1)*MOD;
        x %= MOD;
    }
    return x;
}

ll mpow(ll a,ll b){
    ll res = 1;
    while(b > 0){
        if(b%2==1)res=(res*a)%MOD;
        b/=2;
        a = (a*a)%MOD;
    }
    return res;
}

ll mfactorial(ll a){
    if(mfact.size()-1 >= a)return mfact[a];
    for(ll i = mfact.size();i<=a;i++){
        mfact.push_back((i * mfact[i-1])%MOD);
    }
    return mfact[a];
}

ll mcomb(ll n, ll r){
    return (((mfactorial(n) * minv(mfactorial(r)))%MOD) * minv(mfactorial(n-r)))%MOD;
}

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

int main(){
    int N;cin>>N;
    ll zero_zero = 0, zero_n = 0, n_zero = 0;
    map<pair<ll,ll>, pair<ll,ll>> numBunsu;
    for(int i = 0;i < N;i++){
        ll a,b;cin>>a>>b;
        if(a == b && b == 0){
            zero_zero++;
            continue;
        }else if(a == 0){
            zero_n++;
            continue;
        }else if(b == 0){
            n_zero++;
            continue;
        }
        ll d = gcd(abs(a),abs(b));
        a /= d;
        b /= d;
        if(b < 0){
            a = -a;
            b = -b;
        }
        if(a > 0){
            if(numBunsu.find(pair{a,b}) == numBunsu.end()){
                numBunsu[pair{a,b}] = pair{0,0};
            }
            numBunsu[pair{a,b}].first++;
        }else{
            a = -a;
            if(numBunsu.find(pair{b,a}) == numBunsu.end()){
                numBunsu[pair{b,a}] = pair{0,0};
            }
            numBunsu[pair{b,a}].second++;
        }

    }
    ll result = 1;
    for(auto itr = numBunsu.begin();itr != numBunsu.end();itr++){
        pair<ll,ll> p = itr->second;
        ll a = (mpow(2, p.first) + mpow(2,p.second) - 1LL+MOD)%MOD;
        result = result * a % MOD;
    }
    ll a = (mpow(2, n_zero) + mpow(2,zero_n) - 1LL+MOD)%MOD;
    result = result * a % MOD;
    result = (result + zero_zero) % MOD;
    cout<<result-1LL<<endl;
}
