#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

ll mod = 1e9+7;

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

int main() {
    ll N;
    cin >> N;

    vector<pair<ll, ll> > iwashi(N);
    ll zero = 0, a_zero = 0, b_zero = 0;
    REP(i, N) {
        ll a, b, a_abs, b_abs;
        cin >> a >> b;
        if(a == 0 && b == 0) {
            zero++;
        } else if(b != 0 && a == 0) {
            a = 0;
            b = 1;
            a_zero++;
        } else if(b==0 && a != 0) {
            a = 1;
            b = 0;
            b_zero++;
        } else {
            a_abs = abs(a);
            b_abs = abs(b);
            ll gcd = GCD(a_abs, b_abs);
            a /= gcd;
            b /= gcd;
            if(a < 0 && b < 0) {
                a = -a;
                b = -b;
            } else if(a < 0 && b > 0) {
                a = -a;
                b = -b;
            }
        }
        iwashi[i].first = a;
        iwashi[i].second = b;
    }

    set<pair<ll, ll> > frac;
    map<pair<ll, ll>, ll> cnt;
    map<pair<ll, ll>, bool> used;
    REP(i, N) {
        pair<ll, ll> p = make_pair(iwashi[i].first, iwashi[i].second);
        frac.insert(p);
        cnt[p]++;
    }

    vector<ll> choice;

    for(pair<ll, ll> p: frac) {
        if(p.first == 0 || p.second == 0) continue;
        ll a = p.second, b = p.first;
        if((a < 0 && b > 0) || (a < 0 && b < 0)) {
            a = -a;
            b = -b;
        }
        auto inv = frac.find(make_pair(a, -b));
        if(inv != frac.end() && !used[p] && !used[*inv]) {
            // cerr << "pair: " << p.first << " " << p.second << " " << powll(2, cnt[p]) << " " << powll(2, cnt[*inv]) << endl;
            choice.push_back((powll(2, cnt[p]) + powll(2, cnt[*inv]) - 1) % mod);
            used[p] = true;
            used[*inv] = true;
        } else if(inv == frac.end()) {
            choice.push_back((powll(2, cnt[p])) % mod);
            used[p] = true;
        }
    };

    ll ans = 1;
    REP(i, choice.size()) {
        ans *= choice[i];
        ans %= mod;
    }
    ans *= (powll(2, a_zero) + powll(2, b_zero) - 1) % mod;
    ans %= mod;

    cout << (ans + zero - 1 + mod) % mod << endl;

    return 0;
}


Measured memory_bytes: 45412