#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define M 1000000007LL
 
ll kai(ll n){
  ll an = 1;
 while(n){
   an <<=1;
   an%=M;
   n--;
 }
  return an;
}

int main() {
  int N;
  ll x,y;
  map<pair<ll,ll>,pair<ll,ll>> iwa;
  ll worstiwa=0;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> x >> y;
    if(x<0&&y<0){
     x=-x;
     y=-y;
    }
    
    if(!x&&!y){
     worstiwa++;
     continue;
    }
    
    if(!x||!y){
     if(x>y){
       iwa[make_pair(0,1)].first+=1;
     }else{
       iwa[make_pair(0,1)].second+=1;
     }
     continue;
    }
    
    ll wa = gcd(x,y);
    x/=wa;
    y/=wa;
    if(x<0){
      x=-x;
      y=-y;
    }
    
    if(y>0){
     iwa[make_pair(x,y)].first+=1; 
    }else{
     iwa[make_pair(-y,x)].second+=1; 
    }
    
  }
 
  ll sum=1;
  
  for(pair<pair<ll,ll>,pair<ll,ll>> i:iwa){
   // ll a  = ((ll)pow(2,i.second.first)-1)%10;
    sum*=(kai(i.second.first)-1+kai(i.second.second)-1+1)%M;
    sum%=M;
  }
  
  
  
  
  cout << (sum - 1 + worstiwa)%M << endl;
}