#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;
#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

ll koubai(ll a, ll b){
    ll c = min(a, b);
    ll d = max(a, b);
    while(c*d > 0){
        ll z1 = max(c, d);
        ll z2 = min(c, d);
        c = z1%z2;
        d = z2;
    }
    return d;
}

pair <ll, ll> normalize(ll a, ll b){
    ll fugo = 1;
    if (a*b < 0){
        fugo = -1;
    }
    ll kbi = koubai(abs(a), abs(b));
    kbi = max(ll(1), kbi);
    return {abs(a)/kbi * fugo, abs(b)/kbi};
}

ll d = 1000000007;
int main(void){
    ll n; cin >> n;
    map <pair<ll, ll>, ll> mp;
    ll ex = 0;
    REP(i, n){
        ll a; ll b; cin >> a >> b;
        auto normalized = normalize(a, b);
        if ((normalized.first == 0) && (normalized.second == 0)){
            ex += 1;
            continue;
        }
        mp[normalized]++;
    }
    n -= ex;
    map<pair<ll, ll>, ll> chofuku;
    for(auto item: mp){
        pair <ll, ll> p = item.first;
        ll num = item.second;
        if (num == 0){
            continue;
        }
        ll fugo = -1;
        if (p.first >= ll(0)){
            fugo = 1;
        };
        pair <ll, ll> pp;
        pp.first = abs(p.second)*fugo*-1;
        pp.second = abs(p.first);
        ll num2 = mp[pp];
        if (num2 == 0){
            continue;
        }

        chofuku[{max(num, num2), min(num ,num2)}]++;
    }
    ll bai = 1;
    for(auto item: chofuku){
        pair<ll, ll> p = item.first;
        ll num = item.second / 2;
        n -= num*(p.first + p.second);
        ll bai1 = 1;
        REP(_, p.first){
            bai1 *= 2;
            bai1 %= d;
        }
        ll bai2 = 1;
        REP(_, p.second){
            bai2 *= 2;
            bai2 %= d;
        }
        REP(_, num){
            bai *= (bai1+bai2-1);
            bai %= d;
        }
    }
    REP(i, n){
        bai *= 2;
        bai %= d;
    }
    cout << bai-1+ex << endl;
    return 0;
}