#include<bits/stdc++.h>

using namespace std;

const long long mod = 1000000007;

constexpr long long power(long long b, long long e, long long mod){
  long long ret = 1;
  while(e){
    if(e & 1){
      ret *= b;
      ret %= mod;
    }

    b *= b;
    b %= mod;
    e >>= 1;
  }

  return ret;
}

constexpr long long power(long long b, long long e){
  return power(b, e, mod);
}

int main(){
  int N;
  cin >> N;
  
  map<pair<long long, long long>, long long> m;
  for(int i = 0; i < N; i++){
    int A, B;
    cin >> A >> B;
    
    if(A || B){
      long long g = gcd(A, B);
      A /= g;
      B /= g;
    }
    
    if(A < 0){
      A = -A;
      B = -B;
    }
    
    ++m[{A, B}];
  }
  
  long long box = 1;
  
  for(auto[p, c] : m){
    long long A = p.first, B = p.second;
    long long t;
    if(A == 0 && B == 0) continue;
    else if(B <= 0){
      t = m.count({-B, A});
      if(t > 0) continue;
    }else{
      t = m.count({B, -A});
    }
    
    box *= (power(2ll, c) + power(2ll, t) - 1) % mod;
    box %= mod;
  }
  
  box += m.count({0, 0}) - 1;
  
  box %= mod;
  if(box < 0) box += mod;
  
  cout << box << endl;
  
  return 0;
}