#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll,ll> P;
typedef long double ld;

constexpr int MOD = 1000000007;

// + - * / ^
ll mod(ll a)
{
    ll res = a % MOD;
    if(res < 0) {
        return res + MOD;
    }
    return res;
}
ll mul_mod(ll a, ll b)
{
    ll res = ((ll)a * (ll)b) % MOD;
    return mod((ll)res);
}
ll pow_mod(ll a, ll b)
{
    ll res = 1;
    while (b > 0) {
        if(b & 1) {
            res = res * (ll)a % (ll)MOD;
        }
        a = mul_mod(a, a);
        b >>= 1;
    }
    return (ll)res;
}
ll inv_mod(ll a)
{
    return pow_mod(a, MOD - 2);
}
ll div_mod(ll a, ll b)
{
    return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 3000001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll com_mod(ll a, ll b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}


int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<P> ab(n);
    map<P, int> m;
    int zer = 0;
    for (auto &e : ab) {
        cin >> e.first >> e.second;
        ll g = gcd(e.first, e.second);
        if (e.first == 0 && e.second == 0) zer++;
        else {
            // cout << g << "\n";
            e.first /= g; e.second /= g;
            if (e.first < 0) {
                e.first *= -1;
                e.second *= -1;
            }
            if (e.first == 0 && e.second < 0) e.second *= -1;
            m[e] ++;
        }
        // if (e.first == 0 && e.second == 0) zer = true;
    }
    for (auto p : m) {
        eprintf("%lld,%lld : %d\n", p.first.first, p.first.second, p.second);
    }
    eprintf("\n");
    ll ans = 1;
    map<P, bool> used;
    for (auto p : m) {
        if (p.first.first == 0 && p.first.second == 0) continue;
        if (p.second == 0) continue; 
        if (used[p.first]) continue;
        P q = {p.first.second, -p.first.first};
        if (q.first < 0) {
            q.first *= -1;
            q.second *= -1;
        }
        if (q.first == 0 && q.second < 0) q.second *= -1;
        if (m[q] != 0) {
            used[p.first] = used[q] = true;
            eprintf("(%lld,%lld),(%lld,%lld) %d\n", p.first.first, p.first.second, q.first, q.second,
            -1 + pow_mod(2, p.second) + pow_mod(2, m[q]));
            ans = mul_mod(ans, mod(-1 + pow_mod(2, p.second) + pow_mod(2, m[q])));
        } else {
            eprintf("%lld,%lld %d\n", p.first.first, p.first.second, p.second);
            used[p.first] = true;
            ans = mul_mod(ans, pow_mod(2, p.second));
        }
    }
    cout << mod(ans  - 1  + zer) << "\n";
    return 0;
}

Measured memory_bytes: 43700