#include <bits/stdc++.h>
int gcd(long long int a, long long int b) {
  if (std::max(a, b) % std::min(a, b) == 0) {
    return std::min(a, b);
  }
  return gcd(std::max(a, b) % std::min(a, b), std::min(a, b));
}
std::pair<long long int, long long int> norm(long long int a, long long int b) {
  long long int g = gcd(std::abs(a), std::abs(b));
  return std::make_pair(((b < 0) ? -a : a) / g, std::abs(b) / g);
}
int main() {
  int n;
  constexpr static long long int mod = 1000000007;
  long long int ans = 1, zero = 0;
  std::cin >> n;
  std::vector<int> p2(n);
  p2[0] = 1;
  for (int i = 0; i < (n - 1); i++) {
    p2[i + 1] = (p2[i] * 2) % mod;
  }
  std::map<std::pair<long, long>, std::pair<long, long>> eq;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    std::cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a == 0) {
      eq[std::make_pair(0LL, 0LL)].first++;
      continue;
    }
    if (b == 0) {
      eq[std::make_pair(0LL, 0LL)].second++;
      continue;
    }
    auto n = norm(a, b);
    if (n.first < 0) {
      eq[std::make_pair(n.second, -n.first)].second++;
    } else {
      eq[n].first++;
    }
  }
  if (zero != 0) {
    ans = zero % mod;
  }
  for (auto&& e : eq) {
    ans = (ans * ((p2[e.second.first] + p2[e.second.second] - 1) % mod)) % mod;
  }
  ans--;
  std::cout << ans << "\n";
  return 0;
}
