#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define ROF(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

const ll MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    map <pll, pll> cnt;
    ll c0 = MOD - 1;
    vll pw2(n + 1);
    pw2[0] = 1;
    FOR(i, 1, n) {
        pw2[i] = pw2[i - 1] * 2 % MOD;

        int a, b; cin >> a >> b;
        if (!a && !b) c0++;
        int g = __gcd(a, b);
        a /= g, b /= g;
        if (a <= 0) cnt[{b, -a}].se++;
        else cnt[{a, b}].fi++;
    }
    ll ans = 1;
    for (auto u : cnt)
        ans = ans * (pw2[u.se.fi] + pw2[u.se.se] - 1 + MOD) % MOD;
    cout << (ans + c0) % MOD << endl;
}