#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;
double pi=3.1415926535;

ll power(ll x,ll n){
    if(n==0) return 1;
    ll res=power(x*x%mod,n/2);
    if(n&1) res=res*x%mod;
    return res;
}

int main(){
  int n;
  cin>>n;
  ll a[n];
  ll b[n];
  rep(i,0,n){
    cin>>a[i]>>b[i];
  }
  map<P,int> sei,fu;
  int zero=0;
  int c=0;
  int d=0;
  rep(i,0,n){
    if(a[i]==0 && b[i]==0){
      zero++;
    }
    else if(a[i]==0 && b[i]!=0){
      c++;
    }
    else if(a[i]!=0 && b[i]==0){
      d++;
    }
    else{
      if(a[i]>0 && b[i]>0){
        ll e=gcd(a[i],b[i]);
        sei[P(abs(a[i]/e),abs(b[i]/e))]++;
      }
      else{
        ll e=gcd(a[i],b[i]);
        fu[P(abs(a[i]/e),-abs(b[i]/e))]++;
      }
    }
  }
  
  ll ans=1;
  for(auto p:sei){
    if(fu.count(P(p.first.second,-p.first.first))){
      ll cur=power(2,p.second)+power(2,fu[P(p.first.second,-p.first.first)])-1;
      if(cur<0) cur+=mod;
      cur%=mod;
      ans*=cur;
      ans%=mod;
    }
    else{
      ans*=power(2,p.second);
      ans%=mod;
    }
  }
  for(auto p:fu){
    if(sei.count(P(-p.first.second,p.first.first))){
    }
    else{
      ans*=power(2,p.second);
      ans%=mod;
    }
  }
  
  ll now=power(2,c)+power(2,d)-1;
  if(now<0) now+=mod;
  ans*=now;
  ans%=mod;
  ans+=zero;
  ans--;
  if(ans<0) ans+=mod;
  cout<<ans<<endl;
}