#include <iostream>
#include <map>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
constexpr ll mod = 1000000007;
map<pll,ll> mp;
ll pw(ll a,ll x){
    ll ret = 1;
    while(x){
        if(x&1) (ret *= a) %= mod;
        (a *= a) %= mod; x /= 2;
    }
    return ret;
}

ll gcd(ll a, ll b){
    if(a<0) a *= -1;
    if(b<0) b *= -1;
    if(a<b) swap(a,b);
    if(b==0) return a;
    return gcd(a%b,b);
}

int main(){
    int i,n,cnt = 0;
    cin >> n;
    for(i=0;i<n;i++){
        ll a,b; cin >> a >> b;
        if(a==0 && b==0){
            cnt++;
            ecit(1);
        }else{
            ll x = gcd(a,b);
            a /= x; b /= x;
            if(a<0){
                a *= -1; b *= -1;
            }
            if(a==0){
                if(b<0) b*= -1;
            }
            mp[{a,b}]++;
        }
    }
    ll ans = 1;
    for(auto p:mp){
        auto pp = p.first;
        ll a = pp.first,b = pp.second;
        ll aa = -b,bb = a;
        if(aa<0){
            aa *= -1; bb *= -1;
        }
        if(aa==0){
            if(bb<0) bb *= -1;
        }
        if(mp.find({aa,bb})!=mp.end()){
            ll s = mp[{aa,bb}],t = p.second;
            (ans *= ((pw(2,s) + pw(2,t) - 1)%mod)) %= mod;
            mp.erase({aa,bb});
        }else{
            (ans *= pw(2,p.second)) %= mod;
        }
    }
    (ans += cnt) %= mod;
    cout << ans - 1 << endl;
}
