/*
	*	Created By: 'Present_Sir'
	*	Created On: Saturday 22 August 2020 01:41:32 PM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define all(v) v.begin(),v.end()
#define int long long
#define float long double
using namespace std;
const int mod = (int)1e9 + 7;
int modpow(int a, int n) {
 
    int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
 
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
 
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
using mint = ModInt<mod>;
void solve(){
    int n;
    cin>>n;
    vector < int > fact(n+1,1); 
    vector < int > po(n+1,1);

    for(int i=1; i<=n; ++i){
        po[i] = (po[i-1]*2)%mod;
    }
    
    for(int i=2; i<=n; ++i){
        fact[i] = (fact[i-1]*i)%mod;
    }

    map < pair<int, int> , int > mp;
    int f0=0,s0=0;
    int zero = 0;
    for(int i=0; i<n; ++i){
        int a,b;
        cin>>a>>b;
        if(a == 0 and b == 0){
            ++zero;
            continue;
        }
        if(a == 0){
            ++f0;
            continue;
        }
        if(b == 0){
            ++s0;
            continue;
        }
        int gc = __gcd(a,b);
        //cout<<gc<<endl;
        int va = a/gc;
        int vb = b/gc;
        if(vb<0){
            va *= -1;
            vb *= -1;
        }
        mp[{ va, vb }]++;
        //cout<<va<<" "<<vb<<endl;
    }
    
    map < pair < int, int > , int > vis;
    mint ans = 1;
    for(auto x: mp){
        //cout<<"Cur: "<<x.first.first<<endl;
        if(vis.count(x.first)){
            //cout<<endl;
            continue;
        }
        int a = x.first.first;
        int b = x.first.second;
        int val = x.second;
        //  a &&  b
        // bad -> ( -a && b ) || (a && -b) 
        if(mp.count({b,-a})){
            //cout<<"Second: "<<-a<<" "<<b<<endl;
            pair < int, int > p = {b,-a};
            vis[p]++;
            int val2 = mp[p];
            //cout<<val<<" "<<val2<<endl;
            //cout<<val2<<endl;
            mint curAns = (modpow(2,val2)%mod + modpow(2,val)%mod - 1);
            //curAns%=mod;
            //--curAns;
            //cout<<curAns<<endl;
            //curAns %= mod;
            //cout<<curAns<<" "<<val<<endl;
            ans *= curAns;
            //ans %= mod;
            continue;
        }
        ans *= modpow(2,val);
        //ans %= mod;
    }
    //cout<<ans<<endl;
    ans *= (modpow(2,f0)+modpow(2,s0)-1);
    //ans %= mod;
    ans += zero;
    //ans %= mod;
    ans -= 1;
    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 18760