#include <bits/stdc++.h>
using namespace std;

int64_t Q=1000000007;
int64_t ni(int64_t h){
  int64_t N=h; //ここから
       int64_t a=1,b=0,c=1;
       while(N>0){
         a*=2;
         if(N%a!=0){
           N-=a/2;
           int64_t d=2;
           for(int j=0;j<b;j++){
            d=d*d;
             d=d%Q;
          }
           c=c*d;
          c=c%Q;
         }
        b++;
      } //ここまで
  return c;
}

int main() {
  int64_t M,Z=1,z=0,y=0,f=0;
  cin>>M;
  

  map<pair<int64_t,int64_t>,int64_t> m;
  for(int i=0;i<M;i++){
    int64_t a,b;
    cin>>a>>b;
    if(a==0&&b==0){
      f++;
    }
    else if(a==0){
      z++;
    }
    else if(b==0){
      y++;
    }
    else{
      int64_t p=gcd(abs(a),abs(b));
      a/=p;b/=p;
      if(b<0){
        a=a*-1,b=b*-1;
      }
      m[make_pair(a,b)]++;
    }  
  }
  
  
            
  for(auto x:m){
    int64_t a,b;
    tie(a,b)=x.first;
    if(a<0||b<0){
      continue;
    }
    else if(m.count(make_pair(-1*b,a))){
      Z=(Z*(ni(x.second)+ni(m.at(make_pair(-1*b,a)))-1))%Q;
      M-=(x.second+m.at(make_pair(-1*b,a)));
    }
  }
  Z=(Z*(ni(y)+ni(z)-1))%Q;
  M-=(y+z+f);
  Z=(Z*ni(M))%Q;
  cout<<(Z+f-1)%Q<<endl;
      
      
  
}