#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long powmod(long long a, long long b) {
  if (b == 0) return 1;
  if (b & 1) {
    return a * powmod(a, b - 1) % MOD;
  } else {
    long long d = powmod(a, b / 2) % MOD;
    return d * d % MOD;
  }
}
long long sub(long long a, long long b) { return a + MOD - b; }
long long inv(long long a) { return powmod(a, MOD - 2); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = (0); i < (n); i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] == 0) continue;
    if (a[i] == 0 && b[i] != 0) {
      b[i] = 1;
    } else if (a[i] != 0 && b[i] == 0) {
      a[i] = 1;
    } else {
      long long d = gcd(abs(a[i]), abs(b[i]));
      a[i] /= d;
      b[i] /= d;
      if (b[i] < 0) {
        a[i] *= -1;
        b[i] *= -1;
      }
    }
  }
  map<pair<long long, long long>, long long> mp;
  for (int i = (0); i < (n); i++) {
    if (mp.count({a[i], b[i]}) == 0) mp[{a[i], b[i]}] = 0;
    mp[{a[i], b[i]}]++;
  }
  map<pair<long long, long long>, int> mpi;
  int cnt = 0;
  for (auto p : mp) {
    mpi[p.first] = cnt;
    cnt++;
  }
  vector<bool> used(cnt, false);
  long long ans = 1ll;
  for (auto p : mp) {
    long long x = p.first.first;
    long long y = p.first.second;
    if (x == 0 && y == 0) {
      used[mpi[{x, y}]] = true;
      continue;
    }
    if (!used[mpi[{x, y}]]) {
      long long x2 = -y;
      long long y2 = x;
      if (y2 < 0) {
        x2 *= -1;
        y2 *= -1;
      }
      if (mp.count({x2, y2}) == 1) {
        used[mpi[{x, y}]] = used[mpi[{x2, y2}]] = true;
        long long t = powmod(2, mp[{x, y}]);
        t += (powmod(2, mp[{x2, y2}]) + MOD - 1);
        t %= MOD;
        ans *= t;
        ans %= MOD;
      } else {
        long long t = powmod(2, mp[{x, y}]);
        ans *= t;
        ans %= MOD;
      }
    }
  }
  if (mp.count({0, 0}) == 1) {
    ans++;
    ans %= MOD;
  }
  if (mp.size() > 1 || mp.count({0, 0}) == 0) {
    ans += MOD - 1;
    ans %= MOD;
  }
  cout << ans << endl;
}
