#include <bits/stdc++.h>
using namespace std;
long long n;
map<long long, long long> m, mm;
long long a[200005], b[200005];
const long long mod = 1e9 + 7;
long long qpow(long long a0, long long b0) {
  if (b0 == 0) return 1;
  long long c0 = qpow(a0, b0 / 2);
  if (b0 % 2 == 0)
    return c0 * c0 % mod;
  else
    return a0 * c0 % mod * c0 % mod;
}
int main() {
  long long n;
  scanf("%lld", &n);
  long long sum = 1;
  for (long long i = 0; i < n; i++) {
    scanf("%lld%lld", &a[i], &b[i]);
    if (a[i] == 0 || b[i] == 0) {
      sum++;
      continue;
    }
    long long a1 = abs(a[i]), b1 = abs(b[i]);
    if (a[i] * b[i] > 0)
      m[a1 * qpow(b1, mod - 2)]++;
    else
      m[-a1 * qpow(b1, mod - 2)]++;
  }
  for (long long i = 0; i < n; i++) {
    long long m0, m1, m2, m3;
    long long a1 = abs(a[i]), b1 = abs(b[i]);
    m0 = a1 * qpow(b1, mod - 2);
    m1 = b1 * qpow(a1, mod - 2);
    if (mm[m0] != 0) continue;
    if (a1 == b1) {
      long long mm0 = m[m0];
      long long mm1 = m[-m0];
      long long sum1 = qpow(2, mm0) * qpow(2, mm1) % mod;
      if (mm0 * mm1 != 0) sum1--;
      sum = sum * sum1 % mod;
      continue;
    }
    long long mm0 = m[m0] + m[m1];
    long long mm1 = m[-m0] + m[-m1];
    long long sum1 = qpow(2, mm0) * qpow(2, mm1) % mod;
    if (mm0 * mm1 != 0)
      sum1--;
    else if (mm0 == 0 && mm1 == 0)
      sum1 = 1;
    mm[m0] = mm[m1] = mm[-m0] = mm[-m1] = 1;
    sum *= sum1;
    sum %= mod;
  }
  printf("%lld", sum - 1);
}
