#include <bits/stdc++.h>
using namespace std;

#define ll long long

const ll MOD = 1e9 + 7;

ll fpow(ll a, ll b) {
    ll ret = 1;
    a %= MOD;
    while (b) {
        if (b & 1) {
            ret = (ret * a) % MOD;
        }
        b /= 2;
        a = (a * a) % MOD;
    }
    return ret;
}

void flip(ll &a, ll &b) {
    swap(a, b);
    b *= -1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }

    map<pair<ll, ll>, pair<int, int>> cnt;
    ll zr = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && !a[i]) {
            zr++;
            continue;
        }
        ll gc = __gcd(a[i], b[i]);
        a[i] /= gc;
        b[i] /= gc;
        if (b[i] == 0) {
            a[i] = abs(a[i]);
        }       
        if (a[i] < 0 && b[i] < 0) {
            a[i] *= -1;
            b[i] *= -1;
        }
        if (b[i] < 0 && a[i] > 0) {
            a[i] *= -1;
            b[i] *= -1;
        }
        if (a[i] > 0) {
            cnt[make_pair(a[i], b[i])].first++;
        } else {
            flip(a[i], b[i]);
            cnt[make_pair(a[i], b[i])].second++;
        }
    }
    ll ans = 1;
    for (pair<pair<ll, ll>, pair<int, int>> it: cnt) {
        ll pos = fpow(2, it.second.first) - 1;
        ll neg = fpow(2, it.second.second) - 1;
        ans = (ans * ((pos + neg + 1) % MOD)) % MOD;
    }
    ans = (ans + zr) % MOD;
    ans--;
    cout << ans << '\n';
    return 0;
}