#include <bits/stdc++.h>
using ll = long long int;
constexpr ll mod = 1e9 + 7;
class mint {
  ll num = 0;

 public:
  mint(ll x) : num(x) {}
  mint operator+(const mint &rhs) { return (num + rhs.num) % mod; }
  mint operator*(const mint &rhs) { return num * rhs.num % mod; }
  mint operator-(const mint &rhs) { return (num - rhs.num + mod) % mod; }
  friend std::ostream &operator<<(std::ostream &os, const mint &rhs);
};
std::ostream &operator<<(std::ostream &os, const mint &rhs) {
  os << rhs.num;
  return os;
}
mint pow(mint x, int m) {
  mint re = 1;
  for (int i = 0; i <= 30; ++i) {
    if (m & (1 << i)) re = re * x;
    x = x * x;
  }
  return re;
}
mint inv(mint x) { return pow(x, mod - 2); }
using P = std::pair<ll, ll>;
P normal(P p) { return (p.first >= 0) ? p : P(-p.first, -p.second); }
ll gcd(ll a, ll b) {
  if (a < b) std::swap(a, b);
  return (b == 0) ? a : gcd(b, a % b);
}
P red(P p) {
  ll g = gcd(std::abs(p.first), std::abs(p.second));
  return normal(P(p.first / g, p.second / g));
}
P inv(P p) { return normal(P(p.second, -p.first)); }
std::map<P, int> map;
std::vector<P> vec;
std::set<P> used;
int main() {
  int n;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    std::cin >> a >> b;
    P p = red(P(a, b));
    ++map[p];
    if (!map.count(inv(p))) map[inv(p)] = 0;
  }
  for (auto p : map) {
    if (!used.count(p.first)) {
      vec.emplace_back(p.second, map[inv(p.first)]);
      used.insert(p.first);
      used.insert(inv(p.first));
    }
  }
  mint ans = pow(2, n);
  mint xx = 1;
  for (P p : vec) {
    ans = ans * (pow(2, p.first) + pow(2, p.second) - mint(1)) *
          inv(pow(2, p.first + p.second));
  }
  std::cout << (ans - 1 + mod) << std::endl;
  return 0;
}
