#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = ll(b) - 1; i >= (a); i--)
#define TR(X)                                                  \
    ({                                                         \
        if (0) cerr << "TR: " << (#X) << " = " << (X) << endl; \
    })
#define LL(name) \
    ll name;     \
    cin >> name;
#define VL(name, num) \
    vl name(num);     \
    FOR(INPUT_VL_I, 0, num) { cin >> name[INPUT_VL_I]; }

constexpr ll MOD = 1000000007ll;

pll getNormal(pll p) {
    if (p.yy == 0) p.xx = 1;
    if (p.xx == 0) p.yy = 1;
    if (p.yy < 0) {
        return {-p.xx, -p.yy};
    } else {
        return p;
    }
}

int main() {
    cin.sync_with_stdio(0);
    LL(N);

    map<pll, ll> cnt;

    ll zeroes = 0;
    FOR(i, 0, N) {
        LL(A) LL(B);
        if (A == 0 && B == 0) {
            zeroes++;
            continue;
        }

        ll g = gcd(A,B);

        ll na = A / g;
        ll nb = B / g;

        cnt[getNormal(mp(na, nb))]++;
    }

    vl powers(N + 1);
    powers[0] = 1;
    FOR(i, 1, N + 1) powers[i] = (powers[i - 1] * 2) % MOD;

    ll ans = 1;
    for (auto it : cnt) {
        if (it.yy == 0) continue;

        TR(it.xx.xx);
        TR(it.xx.yy);
        TR(it.yy);

        ll factora = (powers[it.yy] - 1 + MOD) % MOD;
        pll other = getNormal(mp(-it.xx.yy, it.xx.xx));

        TR(other.xx);
        TR(other.yy);
        TR(cnt[other]);

        ll factorb = (powers[cnt[other]] - 1 + MOD) % MOD;
        cnt[other] = 0;

        TR(factora);
        TR(factorb);

        ans = (ans * ((factora + 1ll + factorb) % MOD)) % MOD;
        TR(ans);
    }

    cout << (ansr+ zeroes - 1 + MOD) % MOD << endl;
}  // cin.tie(0) bei schnellem Wechseln
