#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

template<typename T, long long MOD_VALUE>
class ModInt {
    static constexpr long long MOD = MOD_VALUE;
private:
    T value_;
public:
    ModInt() {}
    ModInt(const T& value) {if (value >= 0) {value_ = value % MOD;} else {T k = (MOD - 1 - value) / MOD; value_ = (value + k * MOD) % MOD;}}
    ModInt& operator+=(const ModInt& x)  {value_ += x.value_; if (value_ >= MOD) value_ -= MOD; return *this;}
    friend ModInt& operator+=(const T& x, const ModInt& y) {ModInt res(x); res.value_ += x.value_; if (res.value_ >= MOD) res.value_ -= MOD; return res;}
    ModInt& operator-=(const ModInt& x) {if (value_ < x.value_) value_ += MOD; value_ -= x.value_; return *this;}
    friend ModInt& operator-=(const T& x, const ModInt& y) {ModInt res(x); if (res.value_ < y.value_) res.value_ += MOD; res.value_ -= y.value_; return res;}
    ModInt& operator*=(const ModInt& x) {value_ = (value_ * x.value_) % MOD; return *this;}
    friend ModInt& operator*=(const T& x, const ModInt& y) {ModInt res(x); res.value_ = (res.value_ * y.value_) % MOD; return res;}
    const ModInt operator+(const ModInt& x) const {return ModInt(*this) += x;}
    friend const ModInt operator+(const T& x, const ModInt& y) {return ModInt(x) += y;}
    const ModInt operator-(const ModInt& x) const {return ModInt(*this) -= x;}
    friend const ModInt operator-(const T& x, const ModInt& y) {return ModInt(x) -= y;}
    const ModInt operator*(const ModInt& x) const {return ModInt(*this) *= x;}
    friend const ModInt operator*(const T& x, const ModInt& y) {return ModInt(x) *= y;}
    static ModInt modpow(ModInt x, long long y) {ModInt z = 1; while (y > 0) {if (y & 1) {z *= x;}x *= x; y /= 2;} return z;}
    ModInt& operator/=(const ModInt& x) {return *this *= modpow(x, MOD - 2);}
    const ModInt operator/(const ModInt& x) const {return ModInt(*this) /= x;}
    friend const ModInt operator/(const T& x, const ModInt& y) {return ModInt(x) /= y;}
    ModInt operator++(int) {ModInt tmp(*this); value_ = (value_ + 1 == MOD ? 0 : value_ + 1); return tmp;}
    ModInt operator--(int) {ModInt tmp(*this); value_ = (value_ - 1 < 0 ? MOD - 1 : value_ - 1); return tmp;}
    friend istream& operator>>(istream& stream, ModInt& x) {stream >> x.value_; x.value_ %= MOD; return stream;}
    friend ostream& operator<<(ostream& stream, const ModInt& x) {stream << x.value_; return stream;}
};

using mint = ModInt<ll, 1000000007>;
using P = pair<ll, ll>;

ll calc_gcd(ll x, ll y) {
    if (!y) {
        return x;
    }
    return calc_gcd(y, x % y);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    rep(i, 0, N) {
        cin >> A[i] >> B[i];
    }
    map<P, ll> cnt1;
    ll zero = 0;
    rep(i, 0, N) {
        if (!A[i] && !B[i]) {
            ++zero;
            continue;
        }
        ll g = calc_gcd(A[i], B[i]);
        ll e1 = A[i] / g;
        ll e2 = B[i] / g;
        if ((e1 < 0 && e2 >= 0) || (e1 < 0 && e2 < 0)) {
            e1 *= -1;
            e2 *= -1;
        }
        ++cnt1[P(e1, e2)];
    }
    vector<P> cnt2;
    set<P> checked;
    for (auto& c : cnt1) {
        if (checked.count(c.first)) {
            continue;
        }
        ll e1 = -c.first.second;
        ll e2 = c.first.first;
        if ((e1 < 0 && e2 >= 0) || (e1 < 0 && e2 < 0)) {
            e1 *= -1;
            e2 *= -1;
        }
        P another = {e1, e2};
        if (checked.count(another)) {
            continue;
        }
        checked.insert(c.first);
        checked.insert(another);
        cnt2.emplace_back(cnt1[c.first], cnt1[another]);
    }
    mint ans = 1;
    for (auto& p : cnt2) {
        ll c1 = p.first;
        ll c2 = p.second;
        mint now = mint::modpow(2, c1) + mint::modpow(2, c2) - 1;
        ans *= now;
    }
    ans--;
    ans += zero;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 59552