#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, size = 1 << 20, mod = 1000000007;
template <class o>
void qr(o &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
template <class o>
void qw(o x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) qw(x / 10);
  putchar(x % 10 + '0');
}
template <class o>
void pr1(o x) {
  qw(x);
  putchar(' ');
}
template <class o>
void pr2(o x) {
  qw(x);
  puts("");
}
long long gcd(long long x, long long y) { return !x ? y : gcd(y % x, x); }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long power(long long a, long long b = mod - 2) {
  long long c = 1;
  while (b) {
    if (b & 1) c = c * a % mod;
    b /= 2;
    a = a * a % mod;
  }
  return c;
}
map<double, int> s;
int n;
long long ans, cnt, a, b, p[N], x, y;
int main() {
  qr(n);
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] * 2LL % mod;
  for (int i = 1; i <= n; i++) {
    qr(x);
    qr(y);
    if (!x && !y) continue;
    cnt++;
    if (!x)
      a++;
    else if (!y)
      b++;
    else
      s[1.0 * x / y]++;
  }
  ans = 1LL * p[a] * p[b] % mod;
  for (auto i : s) {
    double u = i.first;
    long long v = i.second;
    if (s.count(-1.0 / u)) {
      if (u < 0) ans = ans * (p[v] + p[s[-1.0 / u]] - 1) % mod;
    } else
      ans = ans * p[v] % mod;
  }
  pr2((ans - 1 + mod) % mod);
  return 0;
}
