#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct __INIT {
  __INIT() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} __init;
constexpr int MOD = 1000000007;
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int MAX_N = 2e5 + 5;
long long powmod(long long a, long long b) {
  return b ? powmod(a * a % MOD, b / 2) * (b % 2 ? a : 1) % MOD : 1;
}
long long fac[510000], finv[510000], inv[510000];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 510000; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long facdiv(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return (fac[n] * finv[k]) % MOD;
}
long long LCM(long long a, long long b) {
  if (a == 0 || b == 0) return 0;
  long long tmp, r, x;
  x = a * b;
  if (a < b) tmp = a, a = b, b = tmp;
  r = a % b;
  while (r != 0) a = b, b = r, r = a % b;
  x = x / b;
  return x;
}
long long GCD(long long a, long long b) {
  if (a == 0 || b == 0)
    return max(a, b);
  else
    return (a * b) / LCM(a, b);
}
int main(void) {
  COMinit();
  long long N;
  cin >> N;
  long long A[N], B[N];
  long long ans = (powmod(2, N) - 1 + MOD) % MOD;
  for (long long(i) = 0; (i) < (N); (i)++) {
    cin >> A[i] >> B[i];
    bool m1 = false, m2 = false;
    if (A[i] < 0) m1 = true, A[i] *= -1;
    if (B[i] < 0) m2 = true, B[i] *= -1;
    long long di = GCD(A[i], B[i]);
    A[i] /= di, B[i] /= di;
    if (m1) A[i] *= -1;
    if (m2) B[i] *= -1;
  }
  map<pair<long long, long long>, int> vec;
  long long keisu[N];
  for (long long(i) = 0; (i) < (N); (i)++) keisu[i] = 1;
  long long p = 0;
  for (long long(i) = 0; (i) < (N); (i)++) {
    vec[pair<long long, long long>(A[i], B[i])]++;
    vec[pair<long long, long long>(-A[i], -B[i])]++;
    if (vec[pair<long long, long long>(-B[i], A[i])] >= 1 &&
        vec[pair<long long, long long>(-A[i], -B[i])] == 1)
      p++;
  }
  for (long long(i) = 0; (i) < (N); (i)++) {
    long long cnt = vec[pair<long long, long long>(-B[i], A[i])];
    long long m1 = vec[pair<long long, long long>(A[i], B[i])];
    long long minus =
        ((powmod(2, cnt) - 1 + MOD) * (powmod(2, N - 1 - i - cnt))) % MOD;
    if (p > 1) minus = (minus + powmod(2, N - 1 - i - cnt - 2)) % MOD;
    ans = (ans - minus + MOD) % MOD;
    vec[pair<long long, long long>(A[i], B[i])]--;
    vec[pair<long long, long long>(-A[i], -B[i])]--;
    if (vec[pair<long long, long long>(-B[i], A[i])] >= 1 &&
        vec[pair<long long, long long>(-A[i], -B[i])] == 0)
      p--;
  }
  cout << ans << "\n";
}
