#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <map>

#define MOD 1000000007

using namespace std;

long long int pow2(int k){
 long long int a = 1;
 while(k>0){
   a*=2;
   a%=MOD;
   k--;
 }
 return a;
}

int main() {
  int N;
  cin >> N;

  map<pair<long long int, long long int>, pair<int, int> > gcdMap;
  int z=0;
  for(int i=0;i<N;i++){
    long long int A,B;
    cin >> A >> B;
    if(A==0&&B==0){
      z++;
      continue;
    }else if(A==0){
      B = 1;
    }else if(B==0){
      A = 1;
    }else{
      auto d = __gcd(A,B);
      A/=d;
      B/=d;
      if(B<0){
      	A*=-1;
        B*=-1;
      }
    }
    if(A>0) {
      gcdMap[make_pair(A,B)].first++;
    }else{
      gcdMap[make_pair(B,-1*A)].second++;
    }
  }

  long long int answer=1;
  for(auto p : gcdMap){
  	auto p2=p.second;
    answer*=pow2(p2.first)+pow2(p2.second)-1;
    answer%=MOD;
  }
  cout << answer+z-1 << endl;

}
