#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint p(int n, int k) {
        return fact[n]*ifact[n-k];
    }
}; //comb(10000007);
// comb(5, 2) → 10, comb.p(5, 2) → 20
// comb.fact[4] → 24, 2のN乗 → mint(2).pow(N)

int main() {
    // A 対 Bの値、A,B両方0の場合、Aが0の場合
    int N;
    cin >> N;
    mint ans = 1;
    int Azero = 0, Bzero = 0;
    int zerozero = 0;
    map<pair<ll, ll>, int> mp;
    rep(i, N) {
        ll A, B;
        cin >> A >> B;
        if (A == 0 && B == 0) {
            zerozero++;
            N--;
        } else if (A == 0) {
            Azero += 1;
        } else if (B == 0) {
            Bzero += 1;
        } else {
            ll g = gcd(A, B);
            if (A < 0) {
                A = -A; B = -B;
            }
            A /= g; B /= g;
            mp[make_pair(A, B)]++;
        }
    }
    set<pair<ll, ll>> used;
    ans *= mint(2).pow(Azero) + mint(2).pow(Bzero) - 1;
    for (auto p : mp) {
        auto pl = p.first;
        int x = p.second;
        ll y = pl.first, z = pl.second;
        swap(y, z);
        z *= -1;
        if (y < 0) {
            y *= -1; z *= -1;
        }
        if (used.count(pl)) continue;
        mint mul = mint(2).pow(x) + mint(2).pow(mp[make_pair(y, z)]) - 1;
        used.insert(make_pair(y, z));
        ans *= mul;
    }
    ans += zerozero;
    ans -= 1;
    cout << ans << '\n';
    return 0;
}