#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
      a = a * a % mod;
      n >>= 1;
    }
        return res;
}

long long modinv(long long a,long long mod){
  return modpow(a,mod-2,mod);
}

long long int modfact(long long int n,long long int mod){
  if(n){
    return n*modfact(n-1,mod)%mod;
    }else{
      return 1;
    }
}
int main() {
  cout << fixed << setprecision(10);
  ll n;
  cin >> n;
  vector<ll> a(n),b(n);
  map<pair<ll,ll>,pair<ll,ll>> mp;
  ll cur = 0;
  rep(i,n){
    cin >> a.at(i) >> b.at(i);
    if(a.at(i)==0&&b.at(i)==0){
      if(cur==0){
        cur++;
      }
      cur++;
      continue;
    }else if(b.at(i)==0){
      mp[make_pair(0,1)].first++;
      continue;
    }else if(a.at(i)==0){
      mp[make_pair(1,0)].second++;
      continue;
    }
    ll g = gcd(a.at(i),b.at(i));
    a.at(i)/=g; b.at(i)/=g;
    if(a.at(i)<0){
      a.at(i)=-a.at(i);
      b.at(i)=-b.at(i);
    }
    if(b.at(i)<0){
      b.at(i)=-b.at(i);
      swap(a.at(i),b.at(i));
      mp[make_pair(a.at(i),b.at(i))].second++;
    }else{
      mp[make_pair(a.at(i),b.at(i))].first++;
    }
  }
  ll ans = 1;
  for(auto p:mp){
    ll fir = p.second.first;
    ll sec = p.second.second;
    ll tmp = modpow(2,fir,MOD)+modpow(2,sec,MOD)-1;
    ans = (ans*tmp)%MOD;
  }
  cout << (ans+cur-1)%MOD << endl;
}


