#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////


template <std::uint_fast64_t Modulus> 
struct ModInt {
    using u64 = std::uint_fast64_t;

    u64 a;

    constexpr ModInt(const long long x = 0) noexcept : a(x >= 0 ? x % Modulus : (Modulus - (-x) % Modulus) % Modulus) {}
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    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 long long rhs) const noexcept {return ModInt(*this) ^= rhs;}
    constexpr ModInt &operator+=(const ModInt rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr ModInt &operator/=(ModInt rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp&1) *this *= rhs;
            exp >>= 1;
            rhs *= rhs;
        }
        return *this;
    }
    constexpr ModInt &operator^=(long long exp) noexcept {
        ModInt rhs = a;
        a = 1;
        while (exp) {
            if (exp&1) *this *= rhs;
            exp >>= 1;
            rhs *= rhs;
        }
        return *this;
    }

    bool operator==(const ModInt &p) const {return a == p.a;}
    bool operator!=(const ModInt &p) const {return a != p.a;}

};

using mint = ModInt<MOD>;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<mint> beki(N+1,1);
    rep(i,N) beki[i+1] = beki[i]*2;
    map<pll, ll> dic;
    map<pll, int> check;
    ll cnt0 = 0;
    rep(i,N) {
        ll a, b; cin >> a >> b;
        if (a==0 and b==0) cnt0++;
        else if (a==0) {
            dic[pll(0,1)]++;
            check[pll(0,1)] = 0;
        } else if (b==0) {
            dic[pll(1,0)]++;
            check[pll(1,0)] = 0;
        } else {
            ll c = abs(a);
            ll d = abs(b);
            ll k = gcd(a,b);
            a /= k;
            b /= k;
            if (a < 0) {
                a = -a;
                b = -b;
            }
            dic[pll(a,b)]++;
            check[pll(a,b)] = 0;
        }
    }

    mint ans = 1;

    for (auto i : dic) {
        if (check[i.first]) continue;
        check[i.first] = 1;
        ll a = i.first.first;
        ll b = i.first.second;
        if (a==1 and b==0) {
            if (dic.count(pll(0,1))) {
                ans *= (beki[i.second]+beki[dic[pll(0,1)]]-1);
                check[pll(0,1)] = 1;
            } else ans *= beki[i.second];
        } else if (a==0 and b==1) {
            if (dic.count(pll(1,0))) {
                ans *= (beki[i.second]+beki[dic[pll(1,0)]]-1);
                check[pll(1,0)] = 1;
            } else ans *= beki[i.second];
        } else {
            if (b > 0) a = -a;
            else b = -b;
            if (dic.count(pll(b,a))) {
                ans *= (beki[i.second]+beki[dic[pll(b,a)]]-1);
                check[pll(b,a)] = 1;
            } else ans *= beki[i.second];
        }
    }

    ans += cnt0-1;
    cout << ans.a << ln;
}

Measured memory_bytes: 29760