#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long jou(long long N, long long P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    long long t = jou(N, P / 2);
    return t * t % 1000000007;
  }
  return (N * jou(N, P - 1)) % 1000000007;
}
typedef int fp2[2];
int mod(int a, int m) {
  if (m < 0) {
    m = -m;
  }
  if (a < 0) {
    a = m - ((-a) % m);
  } else {
    a = a % m;
  }
  return a;
}
int jacobi_symbol(int a, int m) {
  int t, temp;
  a = mod(a, m);
  t = 1;
  while (a != 0) {
    while (a % 2 == 0) {
      a = a / 2;
      if (m % 8 == 3 || m % 8 == 5) {
        t = -t;
      }
    }
    temp = a;
    a = m;
    m = temp;
    if (a % 4 == 3 && m % 4 == 3) {
      t = -t;
    }
    a = a % m;
  }
  if (m == 1) {
    return t;
  }
  return 0;
}
void fp2_mult(fp2 c, const fp2 a, const fp2 b, int omega2, int p) {
  fp2 temp;
  temp[0] = mod(a[0] * b[0] + a[1] * b[1] * omega2, p);
  temp[1] = mod(a[0] * b[1] + a[1] * b[0], p);
  c[0] = temp[0];
  c[1] = temp[1];
}
void fp2_pow(fp2 r, const fp2 a, unsigned n, int omega2, int p) {
  fp2 b;
  b[0] = mod(a[0], p);
  b[1] = mod(a[1], p);
  r[0] = 1;
  r[1] = 0;
  while (n > 0) {
    if (n % 2 == 1) {
      fp2_mult(r, r, b, omega2, p);
    }
    fp2_mult(b, b, b, omega2, p);
    n /= 2;
  }
}
int fp_sqrt(int a, int p) {
  int t, omega2;
  fp2 r;
  if (jacobi_symbol(a, p) != 1) {
    return 0;
  }
  do {
    t = rand() % p;
    omega2 = mod(t * t - a, p);
  } while (omega2 == 0 || jacobi_symbol(omega2, p) != -1);
  r[0] = t;
  r[1] = 1;
  fp2_pow(r, r, (p + 1) / 2, omega2, p);
  return r[0];
}
int main() {
  int n;
  cin >> n;
  int az = 0;
  int bz = 0;
  vector<long double> a(n);
  vector<long double> b(n);
  map<long double, int> p;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] != 0) az++;
    if (b[i] == 0 && a[i] != 0) bz++;
    if (a[i] != 0 && b[i] != 0) {
      long double awb = a[i] / b[i];
      if (p.count(awb))
        p.at(awb)++;
      else
        p[awb] = 1;
    }
  }
  long long ans = 1;
  for (auto x : p) {
    if (p.count((0.0 - 1.0) / x.first)) {
      long long memo =
          jou(2, x.second) + jou(2, p.at((0.0 - 1.0) / x.first)) - 1;
      memo %= 1000000007;
      ans *= memo;
      ans %= 1000000007;
      p.erase((0.0 - 1.0) / x.first);
    } else {
      ans *= 2;
      ans % 1000000007;
    }
  }
  ans *= jou(2, az) + jou(2, bz) - 1;
  ans %= 1000000007;
  cout << (ans - 1) % 1000000007 << endl;
}
