//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

[[maybe_unused]] constexpr ll LL_MAX = numeric_limits<ll>::max();
[[maybe_unused]] constexpr ll LL_MIN = numeric_limits<ll>::min();
[[maybe_unused]] constexpr ull ULL_MAX = numeric_limits<ull>::max();

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

template <typename T>
void chmin(T& x, T y) {
    x = min(x, y);
}

template <typename T>
void chmax(T& x, T y) {
    x = max(x, y);
}

ll csum(ll x, ll y) {
    if (x > 0 && y > 0 && x > LL_MAX - y) {
        return LL_MAX;
    }
    if (x < 0 && y < 0 && x < LL_MIN - y) {
        return LL_MIN;
    }
    return x + y;
}

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

// 拡張gcd
static ll egcd(ll x, ll y, ll* out_cx, ll* out_cy) {
    if (x < 0) {
        ll d = egcd(-x, y, out_cx, out_cy);
        if (out_cx) {
            *out_cx *= -1;
        }
        return d;
    }
    if (y < 0) {
        ll d = egcd(x, -y, out_cx, out_cy);
        if (out_cy) {
            *out_cy *= -1;
        }
        return d;
    }
    if (x > y) {
        return egcd(y, x, out_cy, out_cx);
    }
    if (x == 0) {
        if (out_cx && out_cy) {
            *out_cx = 0;
            *out_cy = 1;
        }
        return y;
    }
    ll q = y / x;
    ll r = y % x;
    ll d = egcd(r, x, out_cy, out_cx);
    if (out_cx) {
        *out_cx -= q * *out_cy;
    }
    return d;
}

struct Mod {
    static uint64_t PRIME;
    struct LocalPrime {
        uint64_t backup;
        LocalPrime(uint64_t prime) { backup = exchange(Mod::PRIME, prime); }
        ~LocalPrime() { Mod::PRIME = backup; }
    };
    uint64_t value = 0;
    Mod()
    : value(0) {}
    Mod(ll v) {
        if (v >= 0) {
            value = v % PRIME;
        } else {
            value = PRIME - (-v) % PRIME;
        }
    }
    Mod operator+(const Mod& rhs) const { return Mod(*this) += rhs; }
    Mod& operator+=(const Mod& rhs) {
        value += rhs.value;
        if (value >= PRIME) {
            value -= PRIME;
        }
        return *this;
    }
    Mod operator-(const Mod& rhs) const { return Mod(*this) -= rhs; }
    Mod& operator-=(const Mod& rhs) {
        if (value < rhs.value) {
            value += PRIME;
        }
        value -= rhs.value;
        return *this;
    }
    Mod operator*(const Mod& rhs) const { return Mod(*this) *= rhs; }
    Mod& operator*=(const Mod& rhs) {
        value = (value * rhs.value) % PRIME;
        return *this;
    }
    Mod inv() const { return power(*this, PRIME - 2); }
    Mod operator/(const Mod& rhs) const { return Mod(*this) /= rhs; }
    Mod& operator/=(const Mod& rhs) {
        *this *= rhs.inv();
        return *this;
    }
    static Mod power(Mod rhs, ll exp) {
        Mod ans = 1;
        while (exp > 0) {
            if (exp % 2) {
                ans *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return ans;
    }
};
uint64_t Mod::PRIME = 1000000007;

int main() {
    // オーバーフローに注意
    ll N;
    cin >> N;
    struct P {
        ll A;
        ll B;
    };
    ll zero_cnt = 0;
    unordered_map<ll, unordered_map<ll, pair<ll, ll>>> classified;
    rep(i,0,N) {
        ll A, B;
        cin >> A >> B;
        if (A == 0 && B == 0) {
            zero_cnt++;
            continue;
        }
        ll gcd = egcd(A, B, nullptr, nullptr);
        A /= gcd;
        B /= gcd;
        if (A < 0 && B <= 0) {
            A *= -1;
            B *= -1;
        }
        if (A >= 0 && B < 0) {
            A *= -1;
            B *= -1;
        }
        bool isFirst = A > 0 && B >= 0;
        if (isFirst) {
            classified[A][B].first++;
        } else {
            swap(A, B);
            B *= -1;
            assert(A > 0 && B >= 0);
            classified[A][B].second++;
        }
    }
    Mod ans = 0;
    ans += Mod::power(2, zero_cnt) - 1;
    Mod ans_nonzero = 1;
    for (auto& kv0 : classified) {
//        ll A = kv0.first;
        for (auto& kv1 : kv0.second) {
//            ll B = kv1.first;
            ll first = kv1.second.first;
            ll second = kv1.second.second;
            Mod ans_loc = 0;
            ans_loc += Mod::power(2, first);
            ans_loc += Mod::power(2, second);
            ans_loc -= 1;
            ans_nonzero *= ans_loc;
        }
    }
    ans_nonzero -= 1;
    ans += ans_nonzero;
    cout << ans.value << endl;
}
