#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define M 1000000007LL

int main() {
  //cout << pow(2,2) << endl;
  
  int N;
  ll x,y;
  map<pair<ll,ll>,ll> piwa;
  map<pair<ll,ll>,ll> miwa;
  ll worstiwa=0;
  cin >> N;
  //cout << "start!!" << endl;
  for(int i=0;i<N;i++){
    cin >> x >> y;
    if(x<0&&y<0){
     x=-x;
     y=-y;
    }
    //cout << x << " " << y << endl;
    if(x==0&&y==0){
      worstiwa++;
    }else if(x==0||y==0){
      if(x==0){
        piwa[make_pair(0,1)]+=1;
      }else{
        miwa[make_pair(1,0)]+=1;
      }
    }else{
      ll wa = gcd(x,y);
      //cout << wa << endl;
      
      if((double)x/y>=0){
        piwa[make_pair(x/wa,y/wa)]+=1;
      }else{
        if(x/wa>0){
          miwa[make_pair(x/wa,y/wa)]+=1;
        }else{
          miwa[make_pair(-x/wa,-y/wa)]+=1; 
        }
      
      }
      //iwa[make_pair(x/wa,y/wa)]+=1;
    }
  
  }
  /*
  pair<ll,ll> jj;
  for(pair<pair<ll,ll>,ll> i:piwa){
    jj = i.first;
    cout << "<" << jj.first << "," << jj.second << ">" << " " << i.second << endl;
  }
  //cout << "==============" << endl;
  for(pair<pair<ll,ll>,ll> i:miwa){
    jj = i.first;
    cout << "<" << jj.first << "," << jj.second << ">" << " " << i.second << endl;
  }
  
  //cout << "---------------" << endl;
  */
  
  ll sum=1;
  pair<ll,ll> j;
  pair<ll,ll> empty;
  for(pair<pair<ll,ll>,ll> i:piwa){
    j=i.first;
    empty=make_pair(j.second,-j.first);
    
    //cout << "<" << empty.first << "," << empty.second << ">" << " " << endl;
    if(miwa.count(empty)){
     // cout << "<" << empty.first << "," << empty.second << ">" << " " << endl;// << i.second << endl;
      sum *= pow(2,i.second)-1 + pow(2,miwa.at(empty)) -1 +1;
      //piwa.erase(i.first);
      miwa.erase(empty);
    }else{
      sum *= pow(2,i.second); 
      //iwa.erase(i.first);
    }
    
    sum%=M;
    
  }
  
  for(pair<pair<ll,ll>,ll> i:miwa){
      sum *= pow(2,i.second);
      //iwa.erase(i.first);
    sum%=M;
    }
  
  cout << (sum - 1 + worstiwa)%M << endl;

}