#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

template<int mod> struct ModInt {
    int64_t x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (y % mod + mod) % mod) {}

    ModInt &operator+=(const ModInt &a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &a) {
        x = 1LL * x * a.x % mod;
        return *this;
    }

    ModInt &operator/=(const ModInt &a) {
        *this *= a.inverse();
        return *this;
    }

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

    ModInt operator+(const ModInt a) const {
        return ModInt(*this) += a;
    }

    ModInt operator-(const ModInt a) const {
        return ModInt(*this) -= a;
    }

    ModInt operator*(const ModInt a) const {
        return ModInt(*this) *= a;
    }

    ModInt operator/(const ModInt a) const {
        return ModInt(*this) /= a;
    }

    bool operator==(const ModInt a) const {
        return x == a.x;
    }

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

    ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while (k > 0) {
            if (k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }

    ModInt inverse() const {
        return pow(mod - 2);
    }

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

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
};

const int MOD = 1e9+7;
using modint = ModInt<MOD>;

ll gcd(ll x, ll y) {
    x = abs(x); y = abs(y);
    if (x > y) swap(x, y);
    while (x) {
        ll z = x;
        x = y%x;
        y = z;
    }
    return y;
}

const int MAX = 2e5+10;

int N;
ll A[MAX], B[MAX];

inline ii normalize(ll a, ll b) {
    if (a == 0) b = abs(b);
    else if (a < 0) { a *= -1; b *= -1; }
    ll g = gcd(a, b);
    return make_pair(a/g, b/g);
}

modint solve() {
    set<ii> st;
    map<ii, ll> mp;
    modint ret(1), zero(0);

    REP (i, N) {
        if (A[i] == 0 && B[i] == 0) {
            zero += modint(1);
            continue;
        }
        ii x = normalize(A[i], B[i]);
        st.insert(x);
        mp[x]++;
    }

    FORI(iter, st) {
        ii x = *iter, y = normalize(x.second, -x.first);
        if (x > y && mp[x] > 0 && mp[y] > 0) continue;
        ret *= modint(2).pow(mp[x]) + modint(2).pow(mp[y]) - modint(1);
    }

    return ret + zero - modint(1);
}

int main() {
    cout << fixed << setprecision(15);
    cin >> N;
    REP (i, N) cin >> A[i] >> B[i];
    cout << solve() << endl;
}

Measured memory_bytes: 44224