#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// 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;
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 {
    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(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;
  }
};

int main(){
  int n;
  cin >> n;
  map<pair<ll, ll>, ll> mp;
  map<pair<ll, ll>, bool> mpb;
  mint zeze = 0;
  rep(i, n){
    ll a, b;
    cin >> a >> b;
    if(a == 0 && b == 0){
      zeze += 1;
      continue;
    }
    if(a == 0 || b == 0){
      if(a == 0){
        mp[{a, 1}]++;
        mpb[{a, 1}] = false;
      }else{
        mp[{1, b}]++;
        mpb[{1, b}] = false;
      }
      continue;
    }
    if(a < 0){
      a *= -1;
      b *= -1;
    }
    ll g = gcd(a, b);
    mp[{a/g, b/g}]++;
    mpb[{a/g, b/g}] = false;
  }
  mint ans = 1;
  for(auto p : mp){
    if(mpb[p.first] == true) continue;
    pair<ll, ll> t = {p.first.second, -p.first.first};
    if(t.first < 0){
      t.first *= -1;
      t.second *= -1;
    }
    if(t.first == 0){
      t.second *= -1;
    }

    mint add = 1;
    add += (1LL << p.second) - 1;
    mpb[p.first] = true;
    if(mp.count(t) == 1){
      add += (1LL << mp[t]) - 1;
      mpb[t] = true;
    }
    ans *= add;
  }
  ans -= 1;
  ans += zeze;
  cout << ans.x << endl;

  return 0;
}