#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
struct bun{
    ll si, bo;
    bun() {
        si = 1; bo = 1;
    }
    bun(ll a, ll b) {
        ll sign = (a / abs(a)) * (b / abs(b)); 
        ll gcd = __gcd(abs(a),abs(b));
        si = sign * abs(a) / gcd;
        bo = abs(b) / gcd;
    }
    const bool operator <(const bun &b) const {
        if (si == b.si) {
            return bo < b.bo;
        } else {
            return si < b.si;
        }
    }
};

map<bun, ll> mp, mpr;
set<bun> used;
int n;
ll both0;

ll p[200010];

int main() {
    p[0] = 1;
    for (int i = 1; i < 200010; i++) {
        p[i] = p[i-1] * 2;
        p[i] %= mod;
    }

    cin >> n;
    for (int i = 0; i < n; i++) {
        ll a,b;
        cin >> a >> b;
        if (a == 0 && b == 0)
            both0++;
        else
            mp[bun(a,b)]++;
    }
    
    ll sum = 1;
    for (auto mpp: mp) {
        bun b = mpp.first;
        if (used.count(b)) continue;
        used.insert(b);
        bun rb = bun(-b.bo,b.si);
        // cout << b.si << "/" << b.bo << endl;
        // cout << rb.si << "/" << rb.bo << endl;
        if (mp.count(rb) != 0) {
            // cout << b.si << "/" << b.bo << "->" << (p[mpp.second] + p[mp[rb]] - 1 + mod) % mod << endl;
            used.insert(rb);
            // cout << "  used " << rb.si << "/" << rb.bo << endl;
            sum *= (p[mpp.second] + p[mp[rb]] - 1 + mod) % mod;
        } else {
            sum *= p[mpp.second];
            // cout << b.si << "/" << b.bo << "->" << p[mpp.second] << endl;
        }
    }
    sum = (sum - 1 + mod) % mod;

    ll ans = both0;
    ans += sum;
    ans %= mod;

    cout << ans << endl;
    return 0;
}