//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

const ll mod = 1000000007;

int main () {
    ll n; cin >> n;
    ll zero = 0;
    map<pair<ll, ll>, pair<ll, ll>> mp;
    rep(i, n) {
        ll x, y; cin >> x >> y;
        if (x == 0 && y == 0) {
            zero++;
            continue;
        }
        ll g = __gcd(x, y);
        x /= g; y /= g;
        if (y < 0) x = -x, y = -y;
        if (y == 0 && x < 0) x = -x, y = -y;
        bool rot = false;
        if (x <= 0) {
            rot = true;
            ll tmp = x;
            x = y; y = -tmp;
        }
        if (rot) mp[{x, y}].second++;
        else mp[{x, y}].first++;
    }

    auto ex2 = [&] (ll m) {
        ll res = 1;
        rep(i, m) {
            res *= 2;
            res %= mod;
        }
        return res;
    };
    ll ans = 1;
    for (auto x : mp) {
        ll y = x.second.first;
        ll z = x.second.second;
        //cout << y << endl;
        //cout << z << endl;
        ans *= ((ex2(y) + ex2(z) - 1) % mod);
        ans %= mod;
        //cout << ans << endl;
    }
    ans += zero;
    ans--;
    ans %= mod;
    cout << ans << endl;


    return 0;
}