#include <bits/stdc++.h>
template <typename T>
using MaxHeap = std::priority_queue<T>;
template <typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
void vdeb(std::vector<T> &da) {
  for (int i = 0; i < da.size(); i++) {
    if (i == da.size() - 1)
      std::cout << da[i];
    else
      std::cout << da[i] << ' ';
  }
  std::cout << std::endl;
}
template <typename T>
void vdeb(std::vector<std::vector<T>> &da) {
  for (int i = 0; i < da.size(); i++) {
    std::cout << i << ' ';
    vdeb(da[i]);
  }
  std::cout << std::endl;
}
using namespace std;
long long gcd(long long x, long long y) {
  if (x < y) swap(x, y);
  if (y == 0) return x;
  while (x % y) {
    long long tmp = y;
    y = x % y;
    x = tmp;
  }
  return y;
}
std::pair<int, int> stand(std::pair<int, int> x) {
  if (x.first == 0 && x.second == 0) return {0, 0};
  long long g = gcd(abs(x.first), abs(x.second));
  std::pair<int, int> ret = {x.first / g, x.second / g};
  if (ret.first < 0) {
    ret.first *= -1;
    ret.second *= -1;
  } else if (ret.first == 0) {
    ret.second = abs(ret.second);
  }
  if (ret.second <= 0) {
    ret = {-ret.second, ret.first};
  }
  return ret;
}
const long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<std::pair<long long, long long>> da(n);
  for (int i = (0); i < (int)(n); i++) {
    cin >> da[i].first >> da[i].second;
  }
  vector<long long> li(n + 1, 1);
  for (int i = (0); i < (int)(n); i++) {
    li[i + 1] = li[i] * 2 % mod;
  }
  map<std::pair<int, int>, std::pair<int, int>> mp;
  for (int i = (0); i < (int)(n); i++) {
    std::pair<int, int> now = stand(da[i]);
    if (!mp.count(now)) mp[now] = {0, 0};
    if ((da[i].first <= 0 && da[i].second < 0) ||
        (da[i].first >= 0 && da[i].second > 0))
      mp[now].first++;
    else
      mp[now].second++;
  }
  long long ans = 1;
  for (auto i : mp) {
    if (i.first.first == 0 && i.first.second == 0) continue;
    long long now = li[i.second.first] + li[i.second.second] - 1;
    now = (now + mod) % mod;
    now %= mod;
    ans *= now;
    ans %= mod;
  }
  std::cout << ans - 1 << endl;
}
