#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

template <int MOD = 1000000007>
struct Mint {
    int x;

    Mint() : x(0) {}
    Mint(long long t) {
        x = t % MOD;
        if (x < 0) x += MOD;
    }

    Mint pow(int n) {
        Mint res(1), t(x);
        while (n > 0) {
            if (n & 1) res *= t;
            t *= t;
            n >>= 1;
        }
        return res;
    }

    Mint inv() const {
        int a = x, b = MOD, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return Mint(u);
    }

    Mint &operator+=(Mint a) {
        x += a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mint &operator-=(Mint a) {
        x += MOD - a.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mint &operator*=(Mint a) {
        x = int(1LL * x * a.x % MOD);
        return *this;
    }

    Mint &operator/=(Mint a) {
        return (*this) *= a.inv();
    }

    Mint operator+(Mint a) const {
        return Mint(x) += a;
    }
    Mint operator-(Mint a) const {
        return Mint(x) -= a;
    }
    Mint operator*(Mint a) const {
        return Mint(x) *= a;
    }
    Mint operator/(Mint a) const {
        return Mint(x) /= a;
    }

    Mint operator-() const {
        return Mint(-x);
    }

    bool operator==(const Mint a) {
        return x == a.x;
    }
    bool operator!=(const Mint a) {
        return x != a.x;
    }
    bool operator<(const Mint a) {
        return x < a.x;
    }

    friend ostream &operator<<(ostream &os, const Mint &a) {
        return os << a.x;
    }

    friend istream &operator>>(istream &is, Mint &a) {
        int t;
        is >> t;
        a = Mint<MOD>(t);
        return (is);
    }
};

long long GCD(long long m, long long n) {
    if (n == 0)
        return m;
    else
        return GCD(n, m % n);
}

signed main() {
    int n;
    cin >> n;
    int zero = 0;
    ll a[n], b[n];
    bool c[n] = {};
    rep(i, n) {
        cin >> a[i] >> b[i];
        if (a[i] == 0 && b[i] == 0) {
            zero++;
            continue;
        }
        if ((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)) c[i] = true;
        a[i] = abs(a[i]);
        b[i] = abs(b[i]);
    }
    using P = pair<bool, pair<ll, ll>>;
    Mint<> ans = 1;
    map<P, int> mp;
    int zero1 = 0, zero2 = 0, all = 0;
    rep(i, n) {
        if (a[i] == 0 && b[i] == 0) {
            continue;
        }
        if (a[i] == 0) {
            ans = ans + ans / Mint<>(2).pow(zero2 + all);
            zero1++;
            continue;
        } else if (b[i] == 0) {
            ans = ans + ans / Mint<>(2).pow(zero1 + all);
            zero2++;
            continue;
        }
        ll g = GCD(a[i], b[i]);
        a[i] /= g;
        b[i] /= g;
        ans = ans +
              ans / Mint<>(2).pow(mp[P(c[i], pair<ll, ll>(a[i], b[i]))] + all);
        mp[P(!c[i], pair<ll, ll>(b[i], a[i]))]++;
    }
    ans += zero;
    cout << ans - Mint<>(1) << endl;
    return 0;
}