#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

const int MOD = 1e9+7;
class mint {
    ll x;
public:
    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 {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator *(const mint &a) const {
        mint res(*this);
        return res *= 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 {
        mint res(*this);
        return res /= a;
    }

    friend ostream &operator<<(ostream& os, const mint &m) {
        os << m.x;
        return os;
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;
    vector<pair<ll, ll>> iwashi(N);
    map<pair<ll, ll>, ll> cnt;

    Rep (i, N) {
        ll A, B;
        cin >> A >> B;
        iwashi[i] = {A, B};

        if (A == 0 and B != 0) {
            B = 1;
        }
        if (A != 0 and B == 0) {
            A = -1;
        }
        ll g = gcd(A, B);

        if (g > 1) {
            // cout << A << " " << B << " " << g << "\n";
            A /= g;
            B /= g;
        }
        if (B < 0) {
            A = -A;
            B = -B;
        }
        cnt[{A, B}]++;
    }

    mint ans(1);
    set<pair<ll, ll>> used;

    // for (auto e : cnt) {
    //     cout << e.first.first << " " <<e.first.second << " " << e.second << "\n";
    // }

    for (auto e : cnt) {
        // cout << e.first.first << " " <<e.first.second << " " << e.second << "\n";

        if (used.find(e.first) != used.end()) continue;
        ll a = e.first.first;
        ll b = e.first.second;
        mint tmp = mint(2).pow(e.second);
        used.insert(e.first);
        if (cnt[{b, -a}] > 0) {
            tmp += mint(2).pow(cnt[{b, -a}]);
            tmp -= mint(1);
            used.insert({b, -a});
        }
        if (a == 0 and b == 0) {
            tmp = mint(1);
        }
        // cout << tmp << "\n";
        ans *= tmp;
    }

    ans -= mint(1);
    ans += cnt[{0, 0}];
    cout << ans << endl;    
}

Measured memory_bytes: 68792