#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long>;
using vvi = vector<vi>;
long long n, k, x, y;
long long gcd(long long a, long long b) {
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long moddiv(long long a, long long b) {
  long long x0 = 1000000007, x1 = b, x2, n0 = 0LL, n1 = 1LL, n2, t = a % b, m,
            ans;
  if (t == 0) return a / b;
  for (int i = 0; i < 900; i++) {
    m = x0 / x1;
    x2 = x0 - x1 * m;
    n2 = (n0 - m * n1) % 1000000007;
    if (x2 == 1) {
      ans = (n2 + 1000000007) % 1000000007;
      break;
    }
    x0 = x1;
    x1 = x2;
    n0 = n1;
    n1 = n2;
  }
  return (a + ((t * ans) % 1000000007) * b - t) / b;
}
long long expmod(long long a, long long n) {
  long long ans = 1LL, aa = a, beki = n;
  for (int i = 0; i < 64; i++) {
    if (beki % 2 == 1) ans = ans * aa % 1000000007;
    aa = aa * aa % 1000000007;
    beki /= 2;
    if (beki == 0) break;
  }
  return ans;
}
vi mulmod(500001);
void first_nCk() {
  mulmod[0] = 1;
  for (long long i = 1; i < 500001; i++) {
    mulmod[i] = mulmod[i - 1] * i % 1000000007;
  }
}
long long nCk(long long nn, long long kk) {
  return moddiv(mulmod[nn], mulmod[kk] * mulmod[nn - kk] % 1000000007);
}
int main() {
  long long ans = 1;
  cin >> n;
  vi md(4);
  md[0] = 469762049;
  md[1] = 1811939329;
  md[2] = 2013265921;
  md[3] = 1000000007;
  vi a(n), b(n), pm(n);
  vvi h(n, vi(4));
  for (long long i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (long long i = 0; i < n; i++) {
    if (a[i] < 0) {
      pm[i]++;
    }
    if (b[i] < 0) {
      pm[i]++;
    }
    for (long long j = 0; j < 4; j++) {
      h[i][j] = (a[i] % md[j]) * (b[i] % md[j]) % md[j];
    }
  }
  vector<pair<long long, long long>> pa(n);
  map<pair<long long, long long>, long long> nums;
  long long w = 1;
  long long azc = 0;
  long long bzc = 0;
  long long abzc = 0;
  for (long long i = 0; i < n; i++) {
    if ((a[i] == 0) & (b[i] == 0)) {
      abzc++;
      continue;
    }
    if ((a[i] == 0)) {
      azc++;
      continue;
    }
    if ((b[i] == 0)) {
      bzc++;
      continue;
    }
    long long c = gcd(abs(a[i]), abs(b[i]));
    a[i] /= c;
    b[i] /= c;
    pa[i].first = abs(a[i]);
    pa[i].second = abs(b[i]);
    if (pm[i] % 2 == 1) pa[i].first *= -1;
    nums[pa[i]]++;
  }
  for (auto it : nums) {
    long long num = it.second;
    auto iit = it.first;
    long long da = iit.first;
    long long db = iit.second;
    pair<long long, long long> pl;
    pl.first = -db;
    pl.second = da;
    if ((pl.first < 0) & (pl.second < 0)) {
      pl.first = -pl.first;
      pl.second = -pl.second;
    }
    long long ct = nums[pl];
    nums[iit] = 0;
    nums[pl] = 0;
    long long nn = expmod(2, num) - 1;
    nn += expmod(2, ct) - 1;
    nn = (nn + 1000000007 + 1) % 1000000007;
    ans = ans * nn % 1000000007;
  }
  long long nn = expmod(2, azc) - 1;
  nn += expmod(2, bzc) - 1;
  nn = (nn + 1000000007 + 1) % 1000000007;
  ans = ans * nn % 1000000007;
  if (abzc == 0) {
    ans = (ans + 1000000007 - 1) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
