#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int sign(long long int a) {
  if (a >= 0) return 1;
  return -1;
}
pair<long long int, long long int> mk_rational(long long int a,
                                               long long int b) {
  auto absa = abs(a), absb = abs(b);
  auto common_part = gcd(absa, absb);
  if (!common_part) return pair<long long int, long long int>(0, 0);
  auto sig = sign(a) * sign(b);
  return pair<long long int, long long int>(sig * (absa / common_part),
                                            absb / common_part);
}
pair<long long int, long long int> inverse_invert(
    const pair<long long int, long long int>& a) {
  auto denominator = a.second, numerator = a.first;
  return pair<long long int, long long int>(-1 * sign(numerator) * denominator,
                                            abs(numerator));
}
long long int power_of_2(int exp) {
  if (exp == 0) return 1;
  if (exp == 1) return 2;
  auto temp = power_of_2(exp / 2);
  if (exp % 2)
    return (((2 * temp) % MOD) * temp) % MOD;
  else
    return (temp * temp) % MOD;
}
int main() {
  int N;
  map<pair<long long int, long long int>, int> m;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    long long int A, B;
    scanf("%lld%lld", &A, &B);
    m[mk_rational(A, B)]++;
  }
  long long int ans = 1ll;
  auto special = m.find(mk_rational(0, 0));
  long long int compen =
      special == m.end() ? 0 : (power_of_2(special->second) + (MOD - 1)) % MOD;
  if (special != m.end()) m.erase(special);
  for (auto& ele : m) {
    auto key = ele.first;
    auto count = ele.second;
    long long int contrib = power_of_2(count);
    auto other = m.find(inverse_invert(key));
    if (other != m.end()) {
      contrib = (contrib + power_of_2(other->second) + (MOD - 1)) % MOD;
      m.erase(other);
    }
    ans = (ans * contrib) % MOD;
  }
  ans = ((ans + compen) % MOD + (MOD - 1)) % MOD;
  printf("%lld\n", ans);
  return 0;
}
