#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

ll power(ll x, ll pw, ll mod=1e9+7) {
    ll res = 1;
    x = x % mod;  // if it x >= p
    while (pw > 0) {
        if (pw & 1)
            res = (res*x) % mod;
        pw /= 2;
        x = (x*x) % mod;
    }
    return res;
}

int main() {
    // group perpendicular class
    int n; 
    cin >> n;
    map<pair<ll,ll>, ll> cnt;
    ll mod = 1e9 + 7;
    ll a, b;
    ll all_zero = 0;
    for(int i = 0; i < n; i++) {
        cin >> a >> b;
        if (a == 0 && b != 0) {
            cnt[{0, 1}] += 1;
            continue;
        }
        if (a != 0 && b == 0) {
            cnt[{-1, 0}] += 1;
            continue;
        }
        if (a == 0 && b == 0) {
            all_zero += 1;
            continue;
        }
        ll g = __gcd(a, b);
        cnt[{a/g, b/g}] += 1;
    }
    ll ans = 1;
    // (2^a-1)+(2^b-1) + 1
    set<pair<ll, ll>> used;
    for(auto p: cnt) {
        // cout << p.first.first << ", " << p.first.second << endl;
        if (p.first.first < 0) {
            ll rev0 = p.first.second;
            ll rev1 = -p.first.first;
            if (cnt.count({rev0, rev1}) > 0) { // find pair
                ll tmp = power(2, p.second)-1 + power(2, cnt[{rev0, rev1}]) -1 + 1;
                used.insert({rev0, rev1});
                ans *= (tmp % mod);                
            } else {
                ll tmp = power(2, p.second)-1 + 1;
                ans *= (tmp % mod);
            }
            ans %= mod;
        } else {
            if (used.count(p.first) > 0) // paired
                continue;
            ll tmp = power(2, p.second)-1 + 1;
            ans *= (tmp % mod);
            ans %= mod;
        }
    }
    if (all_zero == 0) {
        cout << ans -1 << endl;
    } else {
        cout << ans -1 + all_zero << endl;
    }
    return 0;
}
