#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr int MOD = 1'000'000'007;

long long power(long long x, long long n, long long mod = 1000000007) {
    if (n == 0) return 1;
    if (n % 2 == 0) return power(x * x % mod, n/2, mod);
    else return x * power(x, n-1, mod) % mod;
}

// auto mod int
struct mint {
    LL x;
    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 {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(const 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 {
        mint res(*this);
        return res/=a;
    }
    LL operator()() const {
        return x;
    }
};
using VM = vector<mint>;
using VVM = vector<VM>;

void solve() {
    int n;
    cin >> n;
    vector<pair<LL,LL>> ps;
    LL a,b;
    REP(i,0,n) {
        cin >> a >> b;
        if (a == 0 && b == 0) continue;
        ps.pb(a,b);
    }

    int only = n - ps.size();
    n = ps.size();
    if (n < 2) {
        cout << n + only << endl;
        return;
    } 

    map<pair<LL,LL>, int> m;
    REP(i,0,n) {
        if (ps[i].first != 0 && ps[i].second != 0) {
            LL g = gcd(abs(ps[i].first), abs(ps[i].second));
            ps[i].first /= g;
            ps[i].second /= g;
        }
        if (ps[i].first == 0) {
            ps[i].second = 1;
        }
        if (ps[i].second == 0) {
            ps[i].first = 1;
        }

        if (ps[i].first < 0) {
            ps[i].first *= -1;
            ps[i].second *= -1;
        }
        m[MP(ps[i].first, ps[i].second)]++;
    }
    int rem = n;
    mint ans = 1;
    for (auto p: m) {
        auto key = p.first;
        int v = p.second;

        auto nkey = MP(key.second, -key.first);
        if (nkey.first <= 0) {
            nkey.first *= -1; 
            nkey.second *= -1; 
        }

        if (v == 0) continue;
        if (m.count(nkey) == 0) continue;
        int ov = m[nkey];
        ans *= (power(2,v) + power(2,ov) - 1) % MOD;
        m[nkey] = 0;
        rem -= v + ov;
    }
    dump(rem);
    ans *= power(2, rem);
    ans -= 1;
    ans += only;

    dump(ans());
    cout << max(0LL, ans()) << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 18556