#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, llabs(y)}].first++; continue;}
    if(y==0){ mp[{y, llabs(x)}].second++; continue;}
    
    if((x>0 && y>0) || (x<0 && y<0)) {mp[{llabs(x), llabs(y)}].first++;}
    if((x>0 && y<0) || (x<0 && y>0)) {mp[{llabs(y), llabs(x)}].second++;}
  }
  
  vector<int> w(n+1);
  w[0] = 1;
  rep(i, n+1){
    if(i == 0) continue;
    w[i] = ( w[i-1]*2 ) % 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 = (ans + zero-1 )%mod;
  
  cout << ans << endl;
  
    return 0;
  }