#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;

#define ff first
#define ss second
#define pb push_back
#define sz size()
#define mp make_pair
#ifndef ONLINE_JUDGE 
#include "/home/asif/Codes/Library/debug.h"
#endif
/*--------------------------------------------------------------------*/

const int N = 1e5 + 5;
const int MOD = 1000000007;

ll bigMod(ll p){
  if(p == 0) return 1LL;
  ll ret = bigMod(p / 2);
  ret *= ret;
  ret %= MOD;
  if(p & 1) ret = (ret * 2) % MOD;
  return ret;
}

map< pii, ll > M;

int main() {

  int n;
  ll x, y;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x >> y;
    if(y < 0){
      y = -y;
      x *= -1LL;
    }
    ll d = __gcd(abs(x), abs(y));
    x /= d, y /= d;
    M[{x, y}]++;
  }
  ll ans = 1LL;
  for(auto it : M){
    if(it.ss == 0) continue;
    x = it.ff.ss, y = -it.ff.ff;
    if(M.find({x, y}) == M.end()) {
      ans *= bigMod(it.ss);
      ans %= MOD;
    }
    else {
      ans *= (bigMod(it.ss) + bigMod(M[{x, y}]) - 1);
      ans %= MOD;
      M[{x, y}] = 0;
    }
  }
  ans--;
  ans %= MOD;
  if(ans < 0) ans += MOD;
  cout << ans << endl;

  return 0;
}