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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

void modMul(lint& a, lint b, lint MOD) {
    a = (a * b) % MOD;
}

lint powmod(lint x, lint k, lint MOD) {
	lint ret = 1;	
	while (k > 0) {
		if (k & 1) modMul(ret, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return ret;
}

int N;
lint A[200005], B[200005];

int main() {
    cin >> N;
    for_(i,0,N) cin >> A[i] >> B[i];

    using PLL = pair<lint,lint>;

    struct Val {
        PLL p;
        int t;
    };

    auto sgn = [&](lint x) {
        if (x < 0) return -1;
        if (x > 0) return 1;
        return 0;
    };

    auto func = [&](lint x, lint y) {
        int t = sgn(x) * sgn(y);
        lint d = __gcd(abs(x), abs(y));
        return Val{PLL(abs(x)/d, abs(y)/d), t + 1};
    };

    lint ans = 0;
    const lint MOD = lint(1e9) + 7;

    map<PLL, int> cnt[3];
    int zero = 0;

    for_(i,0,N) {
        if (A[i] == 0 or B[i] == 0) {
            int x = i - zero;
            ans += powmod(2, x, MOD);
            ++zero;
            // cerr << "hoge" << endl;
        }
        else {
            Val vx = func(A[i], B[i]);
            int x = i - cnt[vx.t][vx.p];
            // cerr << "Check " << vx.t << " " << vx.p.first << " " << vx.p.second << endl;
            // cerr << i << " " << x << endl;
            ans += powmod(2, x, MOD);
            Val vy = func(-B[i], A[i]);
            cnt[vy.t][vy.p] += 1;
            // cerr << "Entry " << vy.t << " " << vy.p.first << " " << vy.p.second << endl;
        }
    }
    cout << ans << endl;
}