#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)
#define MOD 1000000007
#define INF 1e19

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
    int N; cin >> N;
    vector<double> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    map<double, ll> check1, check2;
    int zero = 0;
    vector<double> memo;
    rep(i, N) {
        if (B[i]) {
            if (check1[A[i]/B[i]] <= 0) memo.push_back(A[i]/B[i]);
            check1[A[i]/B[i]]++;
        }
        if (A[i]) {
            check2[-B[i]/A[i]]++;
        }
        if (A[i] == 0 || B[i] == 0) zero++;
        
    }
    ll cnt = 0;
    ll ans = 1;
    set<double> memo2;
    rep(i, memo.size()) {
        if (memo[i] == 0) {
            ans *= modpow(2, zero-1, MOD);
            ans %= MOD;
            cnt += zero;
            continue;
        }
        if (check2[memo[i]] > 0) {
            cnt += check1[memo[i]] + check2[memo[i]];
            ans *= (modpow(2, check1[memo[i]], MOD)-1
            ans %= MOD;
            memo2.insert(1/memo[i]);
        }
    }
    ans *= modpow(2, N-cnt, MOD);
    ans %= MOD;
    cout << ans << endl;
}
