#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long
constexpr int N = 100000 + 100;
constexpr int MOD = 1000000000 + 7;

constexpr int modpow(int a, int n) {
    int rtn = 1;
    while (n > 0) {
        if (n & 1) rtn = rtn * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return rtn;
}

void normalize(pair<int, int> &p) {
    if (p.first <= 0 && p.second <= 0) {
        p.first = abs(p.first), p.second = abs(p.second);
    } else if (p.first <= 0 && p.second >= 0) {
        p.first = abs(p.first), p.second = -abs(p.second);
    }
    const int g = gcd(p.first, p.second);
    p.first /= g, p.second /= g;
}

pair<int, int> rot(pair<int, int> p) {
    if (p.second < 0) return {-p.second, p.first};
    return {p.second, -p.first};
}

class Combination {
   private:
    vector<int> fact, rev_fact;

   public:
    Combination(int n) { setFact(n); }
    void setFact(int n) {
        fact.resize(n + 1);
        rev_fact.resize(n + 1);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = fact[i - 1] * i;
            fact[i] %= MOD;
        }
        rev_fact[n] = modpow(fact[n], MOD - 2);
        for (int i = n - 1; i >= 0; i--) {
            rev_fact[i] = rev_fact[i + 1] * (i + 1);
            rev_fact[i] %= MOD;
        }
    }
    int c(int n, int k) {
        return (((fact[n] * rev_fact[k]) % MOD) * rev_fact[n - k]) % MOD;
    }
    int h(int n, int k) { return c(n + k - 1, k); }
};

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    int n;
    cin >> n;

    int zeros = 0;
    map<pair<int, int>, pair<int, int>> m;

    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;

        if (a == 0 && b == 0) {
            zeros++;
            continue;
        }

        pair<int, int> sardine = {a, b};
        normalize(sardine);

        const bool rotated = sardine.second < 0;
        if (rotated)
            m[rot(sardine)].second++;
        else
            m[sardine].first++;
    }

    int ans = 1;

    for (auto &&mi : m) {
        const int l = mi.second.first, r = mi.second.second;
        int now = 0;
        now += modpow(2, l);
        now += modpow(2, r);
        now--;
        now %= MOD;
        (ans *= now) %= MOD;
    }

    ans += zeros;
    ans -= 1;
    ans = (ans + MOD) % MOD;

    cout << ans << endl;
}
