#include <bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

map<pint,ll> cnt,refe;
map<pint,bool> used;

long long modpow(long long a, long long n) {
    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) {
    return modpow(a, mod - 2);
}

int main(){
  int n;
  cin >> n;
  ll ans=1;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    if(x<0){
      x*=-1;
      y*=-1;
    }
    ll z=__gcd(x,y);
    if(z==0)z=1;
    cnt[{x/z,y/z}]++;
    refe[{x/z,y/z}]++;
  }
  for(auto i : cnt){
    pint p=i.first;
    ll nx=p.first,ny=p.second;
    if(used[{nx,ny}])continue;
    ll temp=modpow(2,refe[{nx,ny}]);
//    cout << temp << 'y' << endl;
    used[{nx,ny}]=true;
    if(ny<0){
      ny*=-1;
      nx*=-1;
    }
    nx*=-1;
    ll g=__gcd(nx,ny);
    if(g==0)g=1;
    nx/=g;
    ny/=g;
    used[{ny,nx}]=true;
    ll nc=refe[{ny,nx}];
//    cout << nc << 'u' << endl;
    temp+=(modpow(2,nc));
    temp--;
//    cout << temp << endl;
    temp%=mod;
    ans*=temp;
    ans%=mod;
  }
//  ans*=modinv(2);
//  ans%=mod;  
  ans+=mod-1;
  ans%=mod;
  cout << ans << endl;
return 0;}