#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

/* [💭] [💡] [🎈] */

const ll mod = 1'000'000'007;
ll pow2[200001];

pll rev(const pll &p) {
    return (p.second < 0 ? pll(-p.second, p.first) : pll(p.second, -p.first));
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    pow2[0] = 1;
    for (int i = 1; i <= 200000; i++) {
        pow2[i] = pow2[i - 1] << 1;
        pow2[i] %= mod;
    }

    ll n;
    cin >> n;

    int zc = 0;
    map<pll, int> mp, revmp;
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        if (!a && !b) {
            zc++;
            continue;
        }
        if (!a) {
            mp[pll(0, 1)]++;
            continue;
        }
        if (!b) {
            mp[pll(1, 0)]++;
            continue;
        }
        if (a < 0) a *= -1, b *= -1;
        ll g = abs(__gcd(a, b));
        a /= g, b /= g;
        mp[pll(a, b)]++;
    }
    for (const auto &kv: mp) revmp[rev(kv.first)] += mp[kv.first];

    ll p = 1;

    map<pll, bool> visit;
    for (const auto &kv: mp) {
        if (visit[kv.first]) continue;
        visit[kv.first] = true;
        visit[rev(kv.first)] = true;

        if (revmp.find(kv.first) != revmp.end()) {
            p *= (pow2[kv.second] + pow2[revmp[kv.first]] + mod - 1) % mod;
        } else {
            p *= pow2[kv.second];
        }
        p %= mod;
    }

    p *= zc + 1;
    p %= mod;

    cout << (p + mod - 1) % mod;

    return 0;
}