
#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;

long long mod_pow(long long x, long long n){
    if(n == 0) return 1;
	if(n % 2) return mod_pow(x,n-1) * x % mod;
  else{  
  	long long buf = mod_pow(x, n/2);
    return buf * buf % mod;
  }
}

int main(){
  int n;
  cin >> n;
  long long ans = 0;
  long long azs = 0, bzs = 0;
  
  map<pair<long long,long long>,long long> mp;
  
  for(int i = 0; n > i; i++){
	long long a,b;
    cin >> a >> b;
    if(a == 0 && b == 0) ans++;
  	else if( a == 0) azs++;
    else if( b == 0) bzs++;
    else {
      long long g = __gcd(abs(a),abs(b));
      a = a/g;
      b = b/g;
      if(b < 0) b = -b, a = -a;	
      mp[{a,b}]++;
      if(a < 0) b = -b, a = -a;	
      mp[{-b,a}] = mp[{-b,a}];
    }
    ans %= mod;
  }
  
  long long buf = 1;
  buf *= mod_pow(2, azs) + mod_pow(2, bzs) - 1; buf %=mod;
  for(auto itr : mp){
     if(itr.first.first < 0){
     	buf *= (mod_pow(2, itr.second) + mod_pow(2, mp[{itr.first.second,-itr.first.first}]) - 1);
       buf %=mod;
     }
  }
  ans += buf-1;
  ans %= mod;
  cout << ans << endl;
  
}