#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)
ll MOD = 1000000007;

ll mpow(ll a, ll n) {  // a^n (mod MOD)
    // 二分累乗法 O(log n)
    ll ans = 1;
    while (n != 0) {
        if (n & 1) ans = ans * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ans;
}

int main() {
    ll N, ans = 1;
    cin >> N;
    map<pair<ll, ll>, int> m;
    for (ll i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        if (b < 0) {
            a *= -1;
            b *= -1;
        }
        ll g = gcd(a, b);
        a /= g;
        b /= g;
        m[make_pair(a, b)]++;
    }

    for (auto& [key, value] : m) {
        if (value == 0) continue;
        ll a = key.first, b = key.second;
        ll c = 1;
        if (a < 0) c *= -1;
        auto x = m[make_pair(b * c * -1, a * c)];
        if (-a == b) {
            ans *= value + 1 + x;
            ans %= MOD;
            if (m.count(make_pair(b * c * -1, a * c)))
                m[make_pair(b * c * -1, a * c)] = 0;
        } else if (x == 0) {
            ans *= mpow(2, value);
            ans %= MOD;
        } else {
            ans *= (mpow(2, value) + mpow(2, x) + MOD - 1) % MOD;
            ans %= MOD;
            if (m.count(make_pair(b * c * -1, a * c)))
                m[make_pair(b * c * -1, a * c)] = 0;
        }
        // cout << ' ' << key.first << ' ' << key.second << ' ' << value << "   " << -b * c << ' ' << a * c << ' ' << x << "   " << ans << endl;
        m[key] = 0;
    }

    ans += MOD - 1;
    ans %= MOD;

    cout << ans << endl;
}
