#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1LL << 60;

ll N;
vector<ll> A, B;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    cin >> N;
    A.resize(N);
    B.resize(N);

    rep(i, N) cin >> A[i] >> B[i];

    map<P, ll> group;

    // grouping
    rep(i, N) {
        ll a, b;
        a = A[i], b = B[i];

        if (a == 0 && b == 0){
            group[P(0, 0)]++;
        } else if (a == 0) {
            group[P(0, -1)]++;
        } else if (b == 0) {
            group[P(1, 0)]++;
        } else {
            ll gcd = __gcd(a, b);
            a /= gcd;
            b /= gcd;
            if (a < 0) {
                a = -a;
                b = -b;
            }
            group[P(a, b)]++;
        }
    }

    // 計算
    mint ans = 1;
    mint zero = 0;
    for (auto v : group) {
        // 0, 0 | 1匹でいることしか出来ない
        if (v.first.first == 0 && v.first.second == 0) {
            zero = v.second;
            continue;
        }

        P p = v.first;
        ll s = v.second;

        ll a = p.first;
        ll b = p.second;

        // cout << a << " " << b << endl;

        ll t;
        // 対となる相方
        if (b < 0) {
            t = 0;
            // group.erase(P(-b, -a));
        } else {
            t = group[P(b, -a)];
            group.erase(P(b, -a));
        }

        // 2 ^ s + 2 ^ t - 1
        mint now = 1;
        now += mint(2).pow(s) - 1;
        now += mint(2).pow(t) - 1;
        // cout << s << " " << t << " " << now << endl;
        ans *= now;

        group.erase(p);
    }

    cout << ans + zero - 1 << endl;
}