#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int R(long long x) {
  if (x < 0) return -1;
  if (x == 0) return 0;
  return 1;
}
long long pow(int x, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret *= x, ret %= mod;
    p /= 2;
    x *= x;
    x %= mod;
  }
  return ret;
}
map<pair<long long, long long>, int> mp;
map<pair<long long, long long>, bool> bk;
long long a[N], b[N], ax[N], bx[N], ans, n, tot;
long long st1[N], st2[N], cnt, cnt00, cnta0, cntb0;
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &a[i], &b[i]);
    int flag = R(a[i]) * R(b[i]);
    if (flag == 0) {
      ax[i] = 0;
      bx[i] = 0;
      if (a[i] == 0 && b[i] == 0)
        cnt00++;
      else if (a[i] == 0)
        cnta0++;
      else
        cntb0++;
      continue;
    }
    ax[i] = abs(a[i]);
    bx[i] = abs(b[i]);
    long long tmp = gcd(ax[i], bx[i]);
    ax[i] /= tmp;
    bx[i] /= tmp;
    pair<long long, long long> now = make_pair(ax[i] * flag, bx[i]);
    mp[now]++;
  }
  for (int i = 1; i <= n; i++) {
    if (ax[i] == 0) continue;
    if (!bk[make_pair(ax[i] * R(a[i]) * R(b[i]), bx[i])]) {
      bk[make_pair(ax[i] * R(a[i]) * R(b[i]), bx[i])] = 1;
      bk[make_pair(bx[i] * R(a[i]) * R(b[i]) * (-1), ax[i])] = 1;
      long long tmp1 =
          1ll * mp[make_pair(bx[i] * R(a[i]) * R(b[i]) * (-1), ax[i])];
      long long tmp2 = 1ll * mp[make_pair(ax[i] * R(a[i]) * R(b[i]), bx[i])];
      if (tmp1 == 0) continue;
      st1[++tot] = tmp1;
      st2[tot] = tmp2;
      cnt += tmp1 + tmp2;
    }
  }
  cnt += cnta0 + cntb0 + cnt00;
  if (cnta0 == 0)
    cnt -= cntb0;
  else if (cntb0 == 0)
    cnt -= cnta0;
  else {
    st1[++tot] = cnta0, st2[tot] = cntb0;
  }
  ans = pow(2, n - cnt) % mod;
  for (int i = 1; i <= tot; i++) {
    long long tmp = (pow(2, st1[i]) + pow(2, st2[i]) - 1) % mod;
    ans *= tmp;
    ans %= mod;
  }
  cout << ans - 1 << endl;
}
