// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template<typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const ll MOD = TEN(9) + 7;
template <long long mod>
long long mod_pow(long long a, long long b) {
    if (b == 0) return 1;
    long long ret = mod_pow<mod>(a, b / 2);
    ret = ret * ret % mod;
    if (b % 2 == 1) ret = a * ret % mod;
    return ret;
}

int main() {
    fastio();

    map<pll, ll> cnt1, cnt2;
    int z1 = 0, z2 = 0;

    int n;
    cin >> n;
    forn(i, n) {
        ll a, b;
        cin >> a >> b;
        ll g = gcd(abs(a), abs(b));
        a /= g, b /= g;
        //cout << a << " " << b << endl;

        if (a == 0 && b == 0) continue;

        if (a == 0) {
            z1++;
            continue;
        }

        if (b == 0) {
            z2++;
            continue;
        }

        if (a >= 0 && b >= 0 || a < 0 && b < 0) {
            cnt1[mp(abs(a), abs(b))]++;
        } else {
            cnt2[mp(abs(a), abs(b))]++;
        }
    }

    ll ans = 1;

    ans = (ans * (mod_pow<MOD>(2, z1) + mod_pow<MOD>(2, z2) - 1 + MOD) % MOD) % MOD;

    for (auto [p, c1] : cnt1) {
        auto [a, b] = p;

        ll c2 = cnt2[mp(b, a)];
        ll temp = (mod_pow<MOD>(2, c1) + mod_pow<MOD>(2, c2) - 1 + MOD) % MOD;
        cnt2.erase(mp(b, a));
        ans = ans * temp % MOD;
    }

    //cout << ans << endl;

    for (auto [p, c2] : cnt2) {
        ll temp = mod_pow<MOD>(2, c2) % MOD;
        ans = ans * temp % MOD;
        //cout << ans << endl;
    }

    cout << (ans - 1 + MOD) % MOD << endl;

    return 0;
}