#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll powmod(ll m, ll p) {
    if (p == 0) return 1;
    ll tmp = powmod(m, p / 2);
    if (p & 1) return (tmp * tmp % MOD) * m % MOD;
    else return tmp * tmp % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    map< P<ll, ll>, ll > abm;
    ll abz = 0, az = 0, bz = 0;
    for (int i = 0; i < n; i++) {
        ll a, b; cin >> a >> b;
        if (a == 0 && b == 0) {
            abz++;
            continue;
        } else if (a == 0) {
            az++;
        } else if (b == 0) {
            bz++;
        } else {
            bool ma = a < 0, mb = b < 0;
            a = abs(a), b = abs(b);
            ll g = gcd(a, b);
            a /= g, b /= g;
            if (ma ^ mb) b = -b;
            abm[make_pair(a, b)]++;
        }
    }

    // for (P< P<ll, ll>, ll> p: abm) {
    //     cout << p.first.first << ' ' << p.first.second << ' ' << p.second << '\n';
    // }

    ll ans = 1;
    while (!abm.empty()) {
        auto it = abm.begin();
        // cout << it->first.first << ' ' << it->first.second << ' ' << it->second << '\n';
        abm.erase(it);
        ll tmp = powmod(2, it->second);
        tmp = (tmp - 1 + MOD) % MOD;
        // cout << "tmp " << tmp << '\n';
        if (!abm.empty() && abm.find(make_pair(-(it->first.second), it->first.first)) != abm.end()) {
            auto it2 = abm.find(make_pair(-(it->first.second), it->first.first));
            abm.erase(it2);
            (tmp += powmod(2, it2->second)) %= MOD;
            tmp = (tmp - 1 + MOD) % MOD;
        }
        if (!abm.empty() && abm.find(make_pair((it->first.second), -(it->first.first))) != abm.end()) {
            auto it2 = abm.find(make_pair((it->first.second), -(it->first.first)));
            abm.erase(it2);
            (tmp += powmod(2, it2->second)) %= MOD;
            tmp = (tmp - 1 + MOD) % MOD;
        }
        tmp = (tmp + 1) % MOD;
        (ans *= tmp) %= MOD;
        // cout << "ans " << ans << '\n';
        // cout << '\n';
    }
    ll tmp = powmod(2, az);
    tmp = (tmp - 1 + MOD) % MOD;
    (tmp += powmod(2, bz)) %= MOD;
    tmp = (tmp - 1 + MOD) % MOD;
    tmp = (tmp + 1) % MOD;
    (ans *= tmp) %= MOD;
    (ans += abz) %= MOD;
    cout << (ans - 1 + MOD) % MOD << '\n';
    return 0;
}


Measured memory_bytes: 15996