#include <bits/stdc++.h>
using namespace std;

template <uint32_t mod>
class modint{
    uint64_t value;
public:
    constexpr modint(const int64_t x=0) noexcept: value(x % mod + (x < 0 ? mod : 0)){ }
    constexpr explicit operator uint64_t() const noexcept{ return value; }
    constexpr modint inverse() const noexcept{ return pow(*this, mod-2); }
    constexpr bool operator==(const modint &rhs) const noexcept{ return value == rhs.value; }
    constexpr bool operator!=(const modint &rhs) const noexcept{ return value != rhs.value; }
    constexpr modint operator+() const noexcept{ return modint(*this); }
    constexpr modint operator-() const noexcept{ return modint(mod - value); }
    constexpr modint operator+(const modint &rhs) const noexcept{ return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const noexcept{ return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const noexcept{ return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const noexcept{ return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) noexcept{
        if((value += rhs.value) >= mod) value -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint &rhs) noexcept{ return *this += mod - rhs.value; }
    constexpr modint &operator*=(const modint &rhs) noexcept{
        if((value *= rhs.value) >= mod) value %= mod;
        return *this;
    }
    constexpr modint &operator/=(const modint &rhs) noexcept{ return *this *= rhs.inverse(); }
    constexpr modint operator++(int) noexcept{
        modint ret(*this);
        if((++value) >= mod) value -= mod;
        return ret;
    }
    constexpr modint operator--(int) noexcept{
        modint ret(*this);
        if((value += mod - 1) >= mod) value -= mod;
        return ret;
    }
    constexpr modint &operator++() noexcept{ return *this += 1; }
    constexpr modint &operator--() noexcept{ return *this -= 1; }
    friend std::ostream &operator<<(std::ostream &os, const modint<mod> &x){ return os << x.value; }
    friend std::istream &operator>>(std::istream &is, modint<mod> &x){
        int64_t i;
        is >> i;
        x = modint<mod>(i);
        return is;
    }
    friend constexpr modint<mod> pow(const modint<mod> &x, uint64_t y){
        modint<mod> ret{1}, m{x};
        while(y > 0){
            if(y & 1) ret *= m;
            m *= m;
            y >>= 1;
        }
        return ret;
    }
};
constexpr int64_t mod = 1'000'000'007; //'
__int128_t dot(const pair<__int128_t, __int128_t> &lhs, const pair<__int128_t, __int128_t> &rhs){
    return lhs.first * rhs.first + lhs.second * rhs.second;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, z = 0, c = 0;
    static pair<__int128_t, __int128_t> ab[200000];
    cin >> n;
    for(int i=0;i<n;++i){
        int64_t a, b;
        cin >> a >> b;
        if(a == 0 && b == 0){ ++z; continue; }
        if(a < 0 || (a == 0 && b < 0)) ab[c++] = {-a, -b};
        else ab[c++] = {a, b};
    }
    sort(ab, ab+c,[](const pair<__int128_t, __int128_t> &lhs, const pair<__int128_t, __int128_t> &rhs){
        if(lhs.first == 0) return false;
        if(rhs.first == 0) return true;
        return lhs.second * rhs.first < rhs.second * lhs.first;
    });

    int cnt = 1;
    vector<pair<int, int>> block;
    for(int i=0;i<c;++i){
        if(i+1 < c && ab[i].second * ab[i+1].first == ab[i+1].second * ab[i].first){ ++cnt; continue; }
        bool rev = ab[i].second > 0;

        if(rev){
            int ll = -1, lr = i, rl = -1, rr = i;
            while(lr - ll > 1){
                int mid = (ll + lr) / 2;
                if(dot(ab[i], ab[mid]) > 0) lr = mid;
                else ll = mid;
            }
            while(rr - rl > 1){
                int mid = (rl + rr) / 2;
                if(dot(ab[i], ab[mid]) >= 0) rr = mid;
                else rl = mid;
            }
            int orth = lr - rr;
            if(orth == 0) block.emplace_back(cnt, orth);
        }else{
            int ll = i, lr = c, rl = i, rr = c;
            while(lr - ll > 1){
                int mid = (ll + lr) / 2;
                if(dot(ab[i], ab[mid]) > 0) ll = mid;
                else lr = mid;
            }
            while(rr - rl > 1){
                int mid = (rl + rr) / 2;
                if(dot(ab[i], ab[mid]) >= 0) rl = mid;
                else rr = mid;
            }
            int orth = rr - lr;
            block.emplace_back(cnt, orth);
        }
        cnt = 1;
    }
    modint<mod> ans = 1;
    for(auto b: block){
        ans *= pow(modint<mod>{2}, b.first) + pow(modint<mod>{2}, b.second) - 1;
    }
    cout << ans - 1 + z << endl;
    return 0;
}

Measured memory_bytes: 11536