#if 1   // use_templates

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))

#define rdi(i) ll i; scanf("%lld", &i)
#define rds(s) string s; cin >> s
#define rdc(c) char c; cin >> c

#define INF 10000000000
#define MOD 1000000007


ll gcd(ll a, ll b);
template<class T>
auto fast_pow(T a, ll n);


template<class T, T n>
struct mod_t
{
    static_assert(n > 0, "invalid divisor");

    T value;

    constexpr mod_t() : value() { }
    constexpr mod_t(T x) : value(normalize(x)) { }

    constexpr operator T() const {
        return value;
    }
    constexpr auto operator+(mod_t<T, n> right) const {
        return mod_t<T, n> { (value + right.value) % n };
    }
    constexpr auto& operator+=(mod_t<T, n> right) {
        return *this = *this + right;
    }
    constexpr auto operator-(mod_t<T, n> right) const {
        return mod_t<T, n> { (value - right.value + n) % n };
    }
    constexpr auto& operator-=(mod_t<T, n> right) {
        return *this = *this - right;
    }
    constexpr auto operator*(mod_t<T, n> right) const {
        return mod_t<T, n> { (value * right.value) % n };
    }
    constexpr auto& operator*=(mod_t<T, n> right) {
        return *this = *this * right;
    }
    constexpr auto operator/(mod_t<T, n> right) const {
        return *this * right.pow(n - 2);
    }
    constexpr auto& operator/=(mod_t<T, n> right) {
        return *this = *this / right;
    }
    constexpr auto pow(ll nn) const {
        return fast_pow(*this, nn);
    }
    constexpr auto inv() const {
        return pow(n - 2);
    }

    static constexpr auto normalize(T x) {
        if (x < 0) {
            return (n + x % n) % n;
        } else {
            return x % n;
        }
    }
};
template<class T, T n>
auto& operator>>(istream& in, mod_t<T, n>& out) {
    T tmp;
    in >> tmp;
    out.value = mod_t<T, n>::normalize(tmp);
    return in;
}
template<class T, T n>
auto& operator<<(ostream& out, mod_t<T, n> val) {
    out << val.value;
    return out;
}
typedef mod_t<ll, MOD> mod;

template<class T, T n>
class combi_t
{
    using value_t = mod_t<T, n>;

    vector<value_t> factn;
    vector<value_t> ifactn;

    ll maxn;

public:
    combi_t() : factn(0), ifactn(0), maxn(0) { }

    combi_t(ll maxn)
        : factn(maxn + 1)
        , ifactn(maxn + 1)
    {
        init(maxn);
    }

    void init(ll maxn) {
        factn.resize(maxn + 1);
        ifactn.resize(maxn + 1);

        this->maxn = maxn;
        factn[0] = 1;
        ifactn[0] = 1;
        for (ll i = 1; i <= maxn; ++i) {
            factn[i] = i * factn[i - 1];
            ifactn[i] = value_t(i).inv() * ifactn[i - 1];
        }
    }

    constexpr auto combi(ll a, ll b) const {
        if (b <= 0 || a - b <= 0) {
            return value_t(1);
        } else {
            return factn[a] * ifactn[b] * ifactn[a - b];
        }
    }

    constexpr auto perm(ll a, ll b) const {
        return factn[a] * ifactn[a - b];
    }

    constexpr auto operator()(ll a, ll b) const {
        return combi(a, b);
    }
};
#define USE_COMBI(maxn) combi_t<ll, MOD> combi(maxn);

template<class T>
auto fast_pow(T a, ll n) {
    if (n <= 0) {
        return T(1);
    } else if (n == 1) {
        return T(a);
    } else if (n % 2 == 0) {
        auto work = fast_pow(a, n / 2);
        return work * work;
    } else {
        return fast_pow(a, n - 1) * a;
    }
}

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

template<class T>
void read_vec(vector<T>& v, ll n)
{
    v.resize(n);
    for (ll i = 0; i < n; ++i) {
        cin >> v[i];
    }
}
template<>
void read_vec<ll>(vector<ll>& v, ll n) {
    v.resize(n);
    for (ll i = 0; i < n; ++i) {
        scanf("%lld", &v[i]);
    }
}
template<class T>
auto read_vec(ll n) {
    vector<T> result;
    read_vec(result, n);
    return result;
}
void read_idxs(vector<ll>& v, ll n) {
    v.resize(n);
    for (ll i = 0; i < n; ++i) {
        scanf("%lld", &v[i]);
        --v[i];
    }
}
auto read_idxs(ll n) {
    vector<ll> result(n);
    for (ll i = 0; i < n; ++i) {
        scanf("%lld", &result[i]);
        --result[i];
    }
    return result;
}
template<class T>
void read_mat(vector<vector<T>>& v, ll n, ll m) {
    v.resize(n);
    for (ll i = 0; i < n; ++i) {
        read_vec(v[i], m);
    }
}
template<class T>
auto read_mat(ll n, ll m) {
    vector<T> result(n);
    for (ll i = 0; i < n; ++i) {
        read_vec(result[i], m);
    }
    return result;
}

#endif  // end of use_templates

struct dat
{
    ll a;
    ll b;
    ll cnt;
};

int main()
{
    ll n;
    cin >> n;
    map<ll, map<ll, ll>> work;
    ll origin = 0;
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        ll aa = abs(a);
        ll bb = abs(b);
        if (aa == 0) {
            if (bb == 0) {
                ++origin;
            } else {
                ++work[0][1];
            }
        } else if (bb == 0) {
            ++work[1][0];
        } else {
            ll cc = gcd(aa, bb);
            if (a > 0) {
                ++work[a / cc][b / cc];
            } else {
                ++work[aa / cc][-(b / cc)];
            }
        }
    }
    
    mod result = 1;

    vector<mod> groups;
    for (auto it = work.begin(); it != work.end(); ++it) {
        ll a = it->first;
        for (auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
            ll b = it2->first;
            ll cnt = it2->second;

            if (cnt <= 0) {
                continue;
            }

            ll pr = 0;
            if (b >= 0 && work.find(b) != work.end()) {
                auto aa = work[b].find(-a);
                if (aa != work[b].end()) {
                    pr = aa->second;
                    aa->second = 0;
                }
            } else if (b < 0 && work.find(-b) != work.end()) {
                auto aa = work[-b].find(a);
                if (aa != work[-b].end()) {
                    pr = aa->second;
                    aa->second = 0;
                }
            }
            if (pr > 0) {
                groups.push_back(mod(2).pow(cnt) + mod(2).pow(pr) - mod(1));
            } else {
                groups.push_back(mod(2).pow(cnt));
            }
        }
    }

    rep(i, groups.size()) {
        result *= groups[i];
    }

    result += origin;
    result -= 1;

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 32944