#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long mod = 1000000007;
long long GCD(long long p, long long q) { return (p == 0) ? q : GCD(q % p, p); }
long long a[maxn], b[maxn], bit[maxn];
int id[maxn];
bool c[maxn];
bool cmp(int p, int q) {
  if (b[p] == b[q] && a[p] == a[q]) return c[p] ? c[p] : c[q];
  return (b[p] == b[q]) ? (a[p] < a[q]) : (b[p] < b[q]);
}
int main() {
  int n;
  long long x, y, gcd;
  cin >> n;
  bit[0] = 1LL;
  for (int i = 1; i <= n; i++) bit[i] = (bit[i - 1] << 1) % mod;
  int zero = 0, up = 0, down = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      a[i] = 0;
      b[i] = 0;
      zero++;
      continue;
    }
    if (x == 0) {
      a[i] = (y == 0) ? 0 : 1;
      b[i] = 0;
      c[i] = true;
      continue;
    }
    if (y == 0) {
      a[i] = (x == 0) ? 0 : 1;
      b[i] = 0;
      continue;
    }
    if (x > 0 && y > 0) {
      a[i] = x;
      b[i] = y;
    }
    if (x < 0 && y < 0) {
      a[i] = -x;
      b[i] = -y;
    }
    if (x > 0 && y < 0) {
      a[i] = -y;
      b[i] = x;
      c[i] = true;
    }
    if (x < 0 && y > 0) {
      a[i] = y;
      b[i] = -x;
      c[i] = true;
    }
    gcd = GCD(a[i], b[i]);
    a[i] /= gcd;
    b[i] /= gcd;
    id[i] = i;
  }
  sort(id + 1, id + 1 + n, cmp);
  long long ans = 1, add;
  for (int i = 1, u; i <= n; i++) {
    u = id[i];
    if (a[u] == 0 && b[u] == 0) continue;
    if (a[u] == a[id[i - 1]] && b[u] == b[id[i - 1]]) {
      if (c[u])
        up++;
      else
        down++;
    } else {
      add = (bit[up] + bit[down] - 1) % mod;
      ans = ans * add % mod;
      up = 0;
      down = 0;
      if (c[u])
        up++;
      else
        down++;
    }
  }
  add = (bit[up] + bit[down] - 1) % mod;
  ans = ans * add % mod;
  ans += zero + mod - 1;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
