#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

    const static long long MOD = 1000000007;

    vector<long long> pow2;
    vector<long long> F;
    vector<long long> IF;

    long long norm(long long a) {
        a %= MOD;
        if (a < 0) {
            a += MOD;
        }
        return a;
    }

    long long inverse(long long a) {
        long long b = MOD;
        long long u = 0, v = 1;
        a = norm(a);
        while (a != 0) {
            long long d = b / a;
            b -= d * a;
            u -= d * v;
            swap(a, b);
            swap(u, v);
        }
        return norm(u);
    }

    long long powM(long long x, long long e) {
        long long res = 1;
        while (e > 0) {
            if (e & 1) {
                res = res * x % MOD;
            }
            x = x * x % MOD;
            e >>= 1;
        }
        return res;
    }

    void init(int n) {
        F.clear();
        F.resize(n + 1, 1);
        IF = F;
        pow2.clear();
        pow2.resize(n + 1, 1);
        for (int i = 1; i <= n; ++i) {
            pow2[i] = pow2[i - 1] * 2 % MOD;
        }

        for (int i = 1; i <= n; ++i) {
            F[i] = F[i - 1] * i % MOD;
        }
        IF[n] = inverse(F[n]);
        for (int i = n - 1; i > 0; --i) {
            IF[i] = IF[i + 1] * (i + 1) % MOD;
        }
    }

    long long nCr(int n, int r) {
        if (r < 0 || r > n) {
            return 0;
        }
        long long res = F[n] * IF[r] % MOD * IF[n - r] % MOD;
        return res;
    }

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<long long> A(n);
    vector<long long> B(n);

    for (int i = 0; i < n; ++i) {
        cin >> A[i] >> B[i];
    }

    auto gcd = [&](long long a, long long b) {
        while (a != 0) {
            b %= a;
            swap(a, b);
        }
        return b;
    };

    vector<int> cnts(4, 0);
    
    vector<pair<long long, long long>> P;
    for (int i = 0; i < n; ++i) {
        int f = 0;
        if (A[i] == 0) {
            f |= 1;
        }
        if (B[i] == 0) {
            f |= 2;
        }
        cnts[f] += 1;
        if (f == 0) {
            auto a = A[i];
            auto b = B[i];
            auto g = gcd(abs(a), abs(b));
            a /= g;
            b /= g;
            P.emplace_back(a, b);
        }
    }

    long long res = 0;
    res += cnts[3];
    res %= MOD;

    map<pair<long long, long long>, int> M;
    for (auto& p : P) {
        auto a = p.first;
        auto b = p.second;
        if (a < 0) {
            a = -a;
            b = -b;
        }
        M[make_pair(a, b)] += 1;
    }

    long long ans = 1;
    set<pair<long long, long long>> used;
    for (auto& p : M) {
        if (used.count(p.first) > 0) {
            continue;
        }
        auto a = p.first.first;
        auto b = p.first.second;
        used.insert(make_pair(a, b));
        long long cnt = powM(2, p.second) - 1;
        {
            auto na = -b;
            auto nb = a;
            if (na < 0) {
                na = -na;
                nb = -nb;
            }
            used.insert(make_pair(na, nb));
            cnt += powM(2, M[make_pair(na, nb)]) - 1;
            cnt = norm(cnt);
        }

        int cnt2 = 0;
        for (auto p2 : P) {
            if (a * p2.first + b * p2.second == 0) {
                ++cnt2;
            }
        }
        (ans *= (cnt + 1)) %= MOD;
        // cout << " C " << a << " " << b << " " <<  cnt << " " << p.second + cnt2  << endl;
    }

    (ans *= norm(powM(2, cnts[1]) - 1 + powM(2, cnts[2]) - 1 + 1)) %= MOD;
    ans = norm(ans - 1);
    res = norm(res + ans);
    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 59256