#include <bits/stdc++.h>
using namespace std;
int _P = 1000000007;
long long _gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  if (a > b) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  if (b == 0) return 0;
  while (b %= a) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  return a;
}
struct pair_hash {
  template <class T1, class T2>
  std::size_t operator()(const pair<T1, T2>& pair) const {
    return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
  }
};
template <class T, class P>
void addto(T& x, P& p) {
  if (x.count(p))
    ++x[p];
  else
    x[p] = 1;
}
long long tpp(int n) {
  long long res = 1;
  long long p = 2;
  while (n > 0) {
    if (n & 1) res = (res * p) % _P;
    n >>= 1;
    p = (p * p) % _P;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  unordered_map<pair<long long, long long>, int, pair_hash> pool;
  for (int i = 1; i <= N; ++i) {
    long long a, b;
    cin >> a >> b;
    pair<long long, long long> p;
    if (a == 0) {
      p.first = 0;
      if (b == 0) {
        p.second = 0;
        addto(pool, p);
      } else {
        p.second = 1;
        addto(pool, p);
      }
      continue;
    }
    if (b == 0) {
      p.first = 1;
      p.second = 0;
      addto(pool, p);
      continue;
    }
    long long d = _gcd(a, b);
    if (a < 0) {
      a = -a;
      b = -b;
    }
    p.first = a / d;
    p.second = b / d;
    addto(pool, p);
  }
  vector<vector<long long>> stat;
  unordered_set<pair<long long, long long>, pair_hash> flag;
  long long reszero = 0;
  for (auto& x : pool) {
    if (x.first.first == 0 && x.first.second == 0)
      ++reszero;
    else if (flag.count(x.first))
      continue;
    else {
      pair<long long, long long> p;
      if (x.first.second <= 0) {
        p.first = -x.first.second;
        p.second = x.first.first;
      } else {
        p.first = x.first.second;
        p.second = -x.first.first;
      }
      flag.insert(p);
      stat.push_back({x.second, pool.count(p) ? pool[p] : 0});
    }
  }
  long long res = 1;
  for (auto& x : stat) {
    long long tmp = tpp(x[0]);
    if (x[1]) tmp = (tmp + tpp(x[1]) - 1) % _P;
    res = (res * tmp) % _P;
  }
  cout << (res + reszero - 1) % _P << endl;
  return 0;
}
