#include <bits/stdc++.h>

using namespace std;
#define ll long long
const int N = 2e5 + 5, mod = 1e9 + 7;

ll p[N];
pair < ll, ll > inv (pair < ll, ll > x) {
    bool neg = 1;
    if (x.first < 0) neg = 0;
    pair < ll , ll > ret = {abs(x.second), abs(x.first)};
    if (neg) ret.first *= -1;
    return ret;
}
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    p[0] = 1;
    for (int i = 1; i < N; i++) {
        p[i] = p[i - 1] * 2;
        p[i] %= mod;
    }
    map<pair<ll, ll>, ll> mp;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        ll a, b;
        cin >> a >> b;
        bool neg = 0;
        if ((a < 0) != (b < 0)) neg = 1;
        a = abs(a), b = abs(b);
        ll g = __gcd(a, b);
        pair<ll, ll> cur = {a / g, b / g};
        if (neg) cur.first *= -1;
        mp[cur]++;
//        cout << cur.first <<' ' << cur.second << endl;
    }
    ll ans = 1;
    for(auto it : mp) {
        if (it.second == 0) continue;
        ll cur = 0;
        pair < ll , ll > c = inv(it.first);
        if (mp.find(c) != mp.end()) {
            cur += p[it.second] - 1;
            cur += p[mp[c]] - 1;
            cur %= mod;
            mp[c] = 0;
            cur ++;
        } else {
            cur = p[it.second];
        }
        ans *= cur;
        ans %= mod;
    }
    cout << ans - 1;
    return 0;
}
