#include<bits/stdc++.h>
using namespace std;
using P = pair<int64_t, int64_t>;

int64_t MOD = 1e9+7;

//繰り返し二乗法
int64_t powmod(int64_t x, int64_t n) { 
  int64_t ans = 1;
  while (n > 0) {
    if ((n & 1) == 1) {
      ans = ans * x;
      ans %= MOD;
    }
    x = x * x;//一周する度にx, x^2, x^4, x^8となる
    x %= MOD;
    n >>= 1; //桁をずらす n = n >> 1
  }
  return ans;
}

int main(){
  int N;
  cin >> N;
  map<P,int> mp;
  int zero = 0;
  for(int i=0; i<N; i++){
    int64_t a, b;
    cin >> a >> b;
    int64_t c = gcd(a,b);
    a /= c;
    b /= c;
    if(b < 0){
      a *= -1;
      b *= -1;
    }
    P p = {a,b};
    if(mp.count(p)){
      mp[p]++;
    }
    else{
      mp[p] = 1;
    }
    if(a == 0 || b == 0){
      zero++;
    }
  }
  
  int64_t ans = 1;
  set<P> S;
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    P p = itr->first;
    int64_t a = p.first;
    int64_t b = p.second;
    if(a < 0){
      P q = {b,a*-1};
      if(mp.count(q)){
        ans *= (powmod(2,mp[p]) - 1 + powmod(2,mp[q]) -1) + 1;
        S.insert(q);
      }
      else{
        ans *= powmod(2,mp[p]);
      }
    }
    else if(a > 0){
      if(S.count(p)){
        continue;
      }
      else{
        ans *= powmod(2,mp[p]);
      }
    }
    ans %= MOD;
  }
  cout << ans - 1 << endl;
}