#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int MAX = 2e5 + 10;
const ll mod = 1000000007;

int N;
ll a[MAX], b[MAX];
ll siz[MAX], color[MAX], c[MAX], col, vis[MAX];
map<piii, int> mp[2];

piii calc(ll x, ll y) {
    x = abs(x), y = abs(y);
    ll gcd = __gcd(x % y, y);
    return piii{x / y, {x % y / gcd, y / gcd}};
}

int main() {
#ifdef ACM_LOCAL
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif
    scanf("%d", &N);
    ll ans = 0;
    for (int i = 1; i <= N; i++) {
        scanf("%lld%lld", a + i, b + i);
        if (a[i] == 0 && b[i] == 0) ans++;
        else {
            piii now = calc(a[i], b[i]), pre = calc(b[i], a[i]);
            int state = 0;
            if (1.0 * a[i] / b[i] > 0) state = 1;
            if (!mp[state].count(now)) {
                mp[state][now] = ++col;
                if (mp[state ^ 1].count(pre))
                    c[col] = mp[state ^ 1][pre], c[mp[state ^ 1][pre]] = col;
            }
            siz[color[i] = mp[state][now]]++;
        }
    }
    ll t = 1;
    for (int i = 1; i <= col; i++)
        if (!vis[i]) {
            vis[i] = 1;
            if (c[i]) {
                vis[c[i]] = 1;
                t = t * ((1ll + siz[i] + siz[c[i]]) % mod) % mod;
            }
            else t = t * (1ll + siz[i]) % mod;
        }
    ans = (ans + t) % mod;
    printf("%lld\n", (ans - 1 + mod) % mod);

    return 0;
}