#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 1000000007;
Int TWO[200001];
int main() {
    TWO[0] = 1;
    for (int i = 1; i <= 200000; i++) TWO[i] = 2 * TWO[i - 1] % MOD;
    int N; cin >> N;
    int zero = 0;
    using Tup = tuple<Int, Int, Int>;
    map<Tup, int> M;
    for (int i = 0; i < N; i++) {
        Int a, b; cin >> a >> b;
        if (a * b == 0) {
            zero += 1;
        } else {
            int sign = 1;
            if (a * b < 0) sign = -1;
            Int g = gcd(abs(a), abs(b));
            M[Tup(sign, abs(a) / g, abs(b) / g)] += 1;
        }
    }
    Int ans = zero + 1;
    for (auto &p : M) {
        if (p.second == -1) continue;
        auto [s, a, b] = p.first;
        auto other = Tup(-s, b, a);
        if (M.count(other)) {
            ans = (TWO[p.second] + TWO[M[other]] + MOD - 1) % MOD * ans % MOD;
            M[other] = -1;
        } else {
            ans = ans * TWO[p.second] % MOD;
        }
    }
    cout << (ans + MOD - 1) % MOD << '\n';
    return 0;
}
