#include <bits/stdc++.h>

#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;
using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

ll gcd_ll(ll a, ll b) {
    if (a % b == 0) {
        return (b);
    } else {
        return (gcd_ll(b, a % b));
    }
}

int main() {
    ll N;
    cin >> N;
    map<pair<ll, ll>, pair<ll, ll>> ms;
    bool is_zz = false;
    rep(i, N) {
        ll a, b;
        cin >> a >> b;

        if (a == 0 && b == 0) {
            is_zz =true;
            continue;
        } else if (a == 0 || b == 0) {
            if (a == 0) {
                b = 1;
                if (ms.find(make_pair(a, b)) == ms.end()) {
                    ms.emplace(make_pair(a, b), make_pair(1, 0));
                } else {
                    ++ms[make_pair(a, b)].first;
                }
            } else {
                a = 1;
                if (ms.find(make_pair(a, b)) == ms.end()) {
                    ms.emplace(make_pair(a, b), make_pair(0, 1));
                } else {
                    ++ms[make_pair(a, b)].second;
                }
            }
        } else if (a < 0 || b < 0) {
            swap(a, b);
            a = abs(a);
            b = abs(b);
            ll div = gcd_ll(min(a, b), max(a, b));
            a /= div;
            b /= div;

            if (ms.find(make_pair(a, b)) == ms.end()) {
                ms.emplace(make_pair(a, b), make_pair(0, 1));
            } else {
                ++ms[make_pair(a, b)].second;
            }
        } else {
            a = abs(a);
            b = abs(b);
            ll div = gcd_ll(min(a, b), max(a, b));
            a /= div;
            b /= div;

            if (ms.find(make_pair(a, b)) == ms.end()) {
                ms.emplace(make_pair(a, b), make_pair(1, 0));
            } else {
                ++ms[make_pair(a, b)].first;
            }
        }
    }

    cpp_int ans = 1;
    for (auto &x : ms) {
        ll num1 = x.second.first;
        ll num2 = x.second.second;
        cpp_int tmp1 = 1;
        rep(i, num1) { tmp1 *= 2; }
        cpp_int tmp2 = 1;
        rep(i, num2) { tmp2 *= 2; }
        ans *= (tmp1 + tmp2 - 1) % mod;
        ans %= mod;
    }

    if (is_zz) ++ans;
    ans = (ans + mod - 1) % mod;

    cout << ans << endl;
}