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

const long long mod = 1000000007;

long long mpow(long long x, long long y){
  long long ret = 1;
  for(int i=0;i<y;i++){
    ret *= x;
    ret %= mod;
  }
  return ret;
}

int main(){
  long long N;
  cin >> N;
  
  vector<long long> A(N),B(N),fugou(N);
  map<pair<long long,long long>,long long> M;
  vector<long long> zero(3,0);
  for(int i=0;i<N;i++){
    cin >> A[i] >> B[i];
    pair<long long,long long> P;
    if(A[i]==0 || B[i]==0){
      fugou[i] = 0;
      if(A[i]==0 && B[i]==0) zero[2]++;
      else if(A[i]==0) zero[0]++;
      else zero[1]++;
    }
    else{
      if((A[i]>0 && B[i]>0)||(A[i]<0 && B[i]<0)) fugou[i] = 1;
      else fugou[i] = -1;
      A[i] = abs(A[i]);
      B[i] = abs(B[i]);
      long long g = gcd(A[i],B[i]);
      A[i] /= g;
      B[i] /= g;
      
      P = make_pair(A[i],B[i]*fugou[i]);
      M[P]++;
    }
  }
  
  long long ans=1;
  for(auto x : M){
    long long a = x.first.first, b = x.first.second, nX = x.second;
    pair<long long,long long> P;
    if(b>0) P = make_pair(b,a*(-1));
    else P = make_pair(b*(-1),a);
    long long nY = M[P];
    
    long long z = mpow(2,nX) + mpow(2,nY) - 1;
    z %= mod;
    ans *= z;
    ans %= mod;
    
    M[x.first] = 0;
    M[P] = 0;
  }
  
  ans += zero[2];
  long long z = mpow(2,zero[0]) + mpow(2,zero[1]) - 1;
  z %= mod;
  ans *= z;
  ans %= mod;
  
  ans = ans + mod - 1;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
