//#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 a, b; cin >> a >> b;
        ll g = __gcd(abs(a), abs(b));
        if (a*b > 0) {
            a /= g; b /= g;
            mp[{abs(a), abs(b)}].first++;
        }
        else if (a*b < 0) {
            a /= g; b /= g;
            mp[{abs(b), abs(a)}].second++;
        }
        else {
            if (a == 0 && b == 0) {
                zero++;
                continue;
            }
            else if (a == 0){
                mp[{0, 1}].first++;
            }
            else {
                mp[{1, 0}].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;
}