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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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; }

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

struct mint {
    long long x;
    mint(long long x=0):x(x % MOD + (0 <= x ? 0 : 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 -= a.x) < 0) x += MOD; return *this; }
    mint& operator*=(const mint& a) { (x *= a.x) %= MOD; return *this; }
    mint operator+(const mint& a) const { return mint(x) += a; }
    mint operator-(const mint& a) const { return mint(x) -= a; }
    mint operator*(const mint& a) const { return mint(x) *= a; }

    // for prime mod
    mint inv() const {
        long long a = x, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        return mint(u);
    }
    mint& operator/=(const mint& a) { return *this *= a.inv(); }
    mint operator/(const mint& a) const { return mint(x) /= a; }
};
istream& operator>>(istream& is, const mint& a){ return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a){ return os << a.x; }

bool sign(ll a, ll b) {
    return (0 <= a && 0 <= b) || (a < 0 && b < 0);
}

tuple<char, ll, ll> make_tuple(ll a, ll b) {
    char c = sign(a, b)? '+' : '-';
    a = abs(a), b = abs(b);
    ll x = a / __gcd(a, b), y = b / __gcd(a, b);
    return make_tuple(c, x, y);
}

tuple <char, ll, ll> reverse(tuple<char, ll, ll> &t) {
    char c = get<0>(t);
    ll x = get<1>(t), y = get<2>(t);
    return make_tuple(c == '-'? '+' : '-', y, x);
}

int main(){
    int N;
    cin >> N;

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

    vector<mint> mul(N+1);
    mul[0] = 1;
    for (int i = 1; i <= N; ++i) mul[i] = mul[i-1] * 2;

    map<tuple<char, ll, ll>, int> mp;
    int count = 0;
    rep(i, N) {
        if (A[i] == 0 && B[i] == 0) {
            count++;
            continue;
        }
        auto t = make_tuple(A[i], B[i]);
        mp[t]++;
    }

    mint ans = 1;
    map<tuple<char, ll, ll>, bool> flg;
    for (auto &p : mp) {
        auto t = p.first;
        if (flg[t]) continue;

        int a = p.second;

        auto rt = reverse(t);
        if (flg[rt]) continue;

        int b = mp[rt];

        ans *= mul[a] + mul[b] - 1;
        flg[t] = 1;
        flg[rt] = 1;
    }

    ans = ans - 1 + count;
    cout << ans << endl;
}