#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 = 1;
        if (a < 0) {
            sign *= -1;
            a = -a;
        }
        if (b < 0) {
            sign *= -1;
            b = -b;
        } 
        ll gcd = __gcd(a,b);
        si = sign * a / gcd;
        bo = 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 b0,a0,both0,no0;

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 (b != 0 && a != 0) {
            mp[bun(a,b)]++;
        } else if (a == 0 && b == 0)
            both0++;
        else if (a == 0)
            a0++;
        else if (b == 0)
            b0++;
    }
    no0 = n - b0 - a0 - both0;
    
    ll sum = 1;
    for (auto mpp: mp) {
        bun b = mpp.first;
        if (mpp.second == 0) continue;
        if (used.count(b)) continue;
        used.insert(b);
        bun rb = bun(-b.bo,b.si);
        if (mp.count(rb)) {
            used.insert(rb);
            sum *= (p[mpp.second] + p[mp[rb]] - 1 + mod) % mod;
            mp[rb] = 0;
        } else {
            sum *= p[mpp.second];
        }
    }
    sum = (sum - 1 + mod) % mod;

    ll ans = both0;
    ans += (p[b0] - 1 + mod) % mod * (sum + 1) % mod;
    ans %= mod;
    ans += (p[a0] - 1 + mod) % mod * (sum + 1) % mod;
    ans %= mod;
    ans += sum;
    ans %= mod;

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