#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    map<pair<ll,ll>,ll> mp;
    map<pair<ll,ll>,ll> seen;
    for(i = 0;i < n;++i){
        cin >> a.at(i) >> b.at(i);
        ll tmp = gcd(abs(a.at(i)), abs(b.at(i)));
        a.at(i) /= tmp;
        b.at(i) /= tmp;
        if(a.at(i) < 0 || (a.at(i) == 0 && b.at(i) < 0)){
            a.at(i) /= -1;
            b.at(i) /= -1;
        }
        ++mp[make_pair(a.at(i), b.at(i))];
        seen[make_pair(a.at(i), b.at(i))] = 0;
    }
    const ll MOD = 1e9+7;
    ll spare = n;
    vector<pair<ll,ll>> dame;
    for(auto x:mp){
        if(seen[x.first] == 1) continue;
        seen[x.first] = 1;
        ll c = x.first.first;
        ll d = x.first.second;
        ll n1 = x.second;
        ll n2 = 0;
        if(seen.count(make_pair(d,-c))){
            auto y = mp[make_pair(d,-c)];
            n2 = y;
            seen[make_pair(d,-c)] = 1;
            dame.emplace_back(n1,n2);
            spare -= n1+n2;
        }
    }
    ll ans = 1;
    for(auto x:dame){
        ans *= (pow_mod(2ll, x.first, MOD) + pow_mod(2ll, x.second, MOD) -1);
        ans %= MOD;
    }
    ans *= pow_mod(2ll, spare, MOD);
    cout << (ans + MOD - 1)%MOD << endl;

    return 0;
}