#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

//input
ll n;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
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;}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
    cin >> n;
    ll zero = 0;
    ll r = 0;
    ll l = 0;
    set<P>st;
    map<P,ll>sei,fu;
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        if(a==0&&b==0){
            zero++;
            continue;
        }
        if(a==0){
            r++;
            continue;
        }
        if(b==0){
            l++;
            continue;
        }
        bool minus = false;
        if(a>0&&b<0)minus=true;
        if(a<0&&b>0)minus=true;
        a = abs(a);
        b = abs(b);
        ll g = __gcd(a,b);
        a /= g;
        b /= g;
        P p = {a,b};
        if(minus)p={a,-b};
        if(minus){
            fu[p]++;
        }
        else{
            st.insert(p);
            sei[p]++;
        }
    }
    mint ans = 0;
    ans += modpow(2,l);
    ans += modpow(2,r);
    ans -= 1;

    for(auto it=sei.begin();it!=sei.end();it++){
        ll x = it->second;
        P p = it->first;
        P opo = {p.second,-p.first};
        ll y = fu[opo];
        mint now = 0;
        now += modpow(2,x);
        now += modpow(2,y);
        now -= 1;
        ans *= now;
    }

    for(auto it=fu.begin();it!=fu.end();it++){
        ll x = it->second;
        if(x==0)continue;
        P p = it->first;
        P opo = {-p.second,p.first};
        if(st.count(opo)>0)continue;
        ans *= modpow(2,x);
    }

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



    return 0;
}

Measured memory_bytes: 28480