#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

ll modpow(ll a, ll n) {
    ll res = 1;
    while (n) {
        if (n & 1)
            (res *= a) %= MOD;
        n >>= 1;
        (a *= a) %= MOD;
    }
    return res;
}

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

    int N;
    cin >> N;
    map<pll, int> cnt;
    for (int i = 0; i < N; ++i) {
        ll A, B;
        cin >> A >> B;
        if (A < 0 || (A == 0 && B < 0))
            A = -A, B = -B;
        if (A != 0 && B != 0) {
            ll g = gcd(A, B);
            A /= g, B /= g;
        }
        cnt[{A, B}]++;
    }

    ll ans = 1;
    for (auto i : cnt) {
        pll tmp = {i.first.second, -i.first.first};
        if (tmp == pll{0, 0})
            continue;

        if (tmp.first < 0 || (tmp.first == 0 && tmp.second < 0)) {
            tmp.first = -tmp.first;
            tmp.second = -tmp.second;
        }

        ll tmp2 = 0;
        if (cnt.find(tmp) != cnt.end()) {
            if (i.first > tmp)
                continue;
            tmp2 = modpow(2, i.second) + modpow(2, cnt[tmp]) - 1 + MOD;
            tmp2 %= MOD;
        } else
            tmp2 = modpow(2, i.second);
        (ans *= tmp2) %= MOD;
    }
    ans--;
    ans += cnt[{0, 0}] + MOD;
    ans %= MOD;

    cout << ans << endl;

    return 0;
}
