#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  int zero = 0;
  map<pair<ll, ll>, pair<int, int>> mp;
    
  rep(i, n){
    ll x, y;
    cin >> x >> y;
    if(x==0 && y==0 ){ zero++; continue;}
      ll g = gcd(x, y);
      x /= g; y /= g;
    if(x==0){ mp[{x, abs(y)}].first++; continue;}
    if(y==0){ mp[{y, abs(x)}].second++; continue;}
    
    if((x>0 && y>0) || (x<0 && y<0)) {mp[{abs(x), abs(y)}].first++;}
    if((x>0 && y<0) || (x<0 && y>0)) {mp[{abs(y), abs(x)}].second++;}
  }
  
  vector<int> w(n); w[0] = 1;
  rep(i, n){
    if(i == 0) continue;
    w[i] = 2*w[i-1] % mod;
  }   
    
  int ans = 1;
  for(auto p: mp){
    int f = p.second.first; int s = p.second.second;
    ans *= (w[f] + w[s] -1) % mod;
  }
    ans += zero-1; //no select
  
  cout << ans << endl;
  
    return 0;
  }