#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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 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() {
    int n;
    cin >> n;
    map<pair<ll,ll>,pair<int,int>>mp;
    int zero = 0;
    rep(i,n) {
        ll a,b;
        cin >> a >> b;
        if(a==0 && b==0) {
            zero++;
            continue;
        }
        if(a==0) {
            mp[{0,1}].first++;
            mp[{1,0}].second++;
            continue;
        }
        if(b==0) {
            mp[{1,0}].first++;
            mp[{0,1}].second++;
            continue;
        }
        ll g = __gcd(a,b);
        a /= g; b /= g;
        if(a<0) {
            a = -a; b = -b;
        }
        
        if(b<0) mp[{-b,a}].second++;
        else mp[{a,b}].first++;
        
    }
    mint ans = 1;
    for(auto p : mp) {
        int cnt = p.second.first;
        int pair_cnt = p.second.second;
        // cout << cnt << " " << pair_cnt << endl;
        mint tmp = 1;
        tmp += mint(2).pow(cnt)-1;
        tmp += mint(2).pow(pair_cnt)-1;
        ans *= tmp;
    }
    ans -= 1;
    ans += zero;
    cout << ans << endl;
}