#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define mp make_pair
#ifndef MY
    #define endl '\n'
#endif
#define int long long
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double db;
typedef long double ldb;
typedef pair < int, int > pii;

ostream & operator << (ostream & out, vector < int > & lst) {
    for (auto a : lst)
        out << a << ' ';
    out << endl;
    return out;
}

const int mod = 1e9 + 7;

struct Int {
    ll x;
    Int (int x = 0) : x(x) {};
    Int operator + (Int a) {
        return Int((x + a.x) % mod);
    }
    Int operator * (Int a) {
        return Int((ll(x) * a.x) % mod);
    }
    Int operator *= (Int a) {
        return Int(x = (ll(x) * a.x) % mod);
    }
    Int operator - (Int a) {
        return Int((x - a.x + mod) % mod);
    }
};

const int N = 2e5 + 5;
Int deg[N];
map < pii, int > cnt;
map < pii, bool > used;

pii f(pii p) {
    if (p.F * p.S < 0) {
        p.F = -(abs(p.F));
        p.S = abs(p.S);
    }
    return p;
}

signed main() {
#ifdef MY
    freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);
#endif // MY
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    deg[0] = 1;
    for (int i = 0; i < n; i++) {
        deg[i + 1] = deg[i] * 2;
        int a, b;
        cin >> a >> b;
        if (a == 0 || b == 0) {
            if (a + b == 0) {
                continue;
            }
            if (a != 0) a = 1;
            if (b != 0) b = 1;
            cnt[{a, b}]++;
            continue;
        }
        if (a * b < 0) {
            b = abs(b);
            a = -abs(a);
        } else if (a < 0) {
            a = -a;
            b = -b;
        }
        int d = __gcd(abs(a), b);
        a /= d, b /= d;
        //cout << a << ' ' << b << endl;
        cnt[{a, b}]++;
    }
    Int ans(1);
    for (auto p : cnt) {
        pii x = p.F;
        if (used[x]) {
            continue;
        }
        int a = p.S;
        pii y = f({x.S, -x.F});
        used[y] = 1;
        int b = cnt[y];
        ans *= (deg[a] + deg[b] - Int(1));
    }
    ans = ans - Int(1);
    cout << ans.x;
    return 0;
}
