#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;
ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最小公倍数

int main(){
  ll N;
  cin>>N;
  map<ll,map<ll,ll>> m;
  vector<pair<ll,ll>> p(N);
  for(int i(0);i<N;i++){
    ll a,b;
    cin>>a>>b;
    if(a < 0 && b < 0){
      a *= -1;
      b *= -1;
    }else if(a < 0 && b > 0){
      a *= -1;b*=-1;
    }
    a %= MOD;
    b %= MOD;
    ll kouyakusuu = gcd(abs(a),abs(b));
    if(kouyakusuu != 0){
      a /= kouyakusuu;
      b /= kouyakusuu;
    }
    //cout << a << " " << b << endl;
    m[a][b]++;
    p[i] = {a,b};
  }
  ll ans(1);
  for(int i(0);i<N;i++){
    ll a = p[i].first,b = p[i].second;
    if(m[a][b] && a>=0 && b>=0){
      ll tmp(0);
      if(!m[b].empty()){
        tmp += m[a][b] + m[b][-a] + 1; //一個
        tmp %= MOD;
        if(m[a][b] >= 2) tmp += (m[a][b]*(m[a][b]-1)/2)%MOD;
        if(m[b][-a] >= 2) tmp += (m[b][-a]*(m[b][-a]-1)/2)%MOD;
        ans *= tmp;
        ans %= MOD;
        m[a][b] = 0;
        m[b][-a] = 0;
      }else{
        tmp += m[a][b] + 1; //一個
        if(m[a][b] >= 2) tmp += (m[a][b]*(m[a][b]-1)/2)%MOD;
        ans *= tmp;
        ans %= MOD;
        m[a][b] = 0;
      }
      //cout << ans << endl;
    }
  }
  for(auto mi:m){
    if(!mi.second.empty()){
      for(auto mii:mi.second){
        //cout << mii.second << endl;
        ans *= (mii.second+1);
        ans %= MOD;
      }
    }
  }
  cout << ans - 1<< endl;
  return 0;
}

