#include <bits/stdc++.h>
using namespace std;
template <typename T>
vector<T> readArray(long long N) {
  vector<T> vec(N);
  for (auto &v : vec) {
    cin >> v;
  }
  return vec;
}
template <typename T>
T read() {
  T a;
  cin >> a;
  return a;
}
long long readInt() {
  long long a;
  cin >> a;
  return a;
}
double readDouble() {
  double a;
  cin >> a;
  return a;
}
string readStr() {
  string a;
  cin >> a;
  return a;
}
namespace math {
long long pow_mod(long long a, long long b, long long M) {
  long ret = 1;
  long tmp = a;
  while (b > 0) {
    if ((b & 1) == 1) ret = (ret * tmp) % M;
    tmp = (tmp * tmp) % M;
    b = b >> 1;
  }
  return ret;
}
long long nCk(long long n, long long k, long long M) {
  long ret = 1;
  long long _min = std::min(k, n - k);
  for (long long i = 1; i <= _min; i++) {
    ret = (ret * pow_mod(i, M - 2, M)) % M;
  }
  for (long long i = n - _min + 1; i <= n; i++) {
    ret = (ret * i) % M;
  }
  return (long long)ret;
}
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
}  // namespace math
pair<long long, long long> _div(long long a, long long b) {
  long long c = math::gcd(a < 0 ? -a : a, b < 0 ? -b : b);
  a /= c;
  b /= c;
  if (b < 0) {
    a *= -1;
    b *= -1;
  }
  return make_pair(a, b);
}
struct hoge {
  long long cnt;
  bool check;
};
void Main() {
  long long n = readInt();
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> a[i] >> b[i];
  }
  map<pair<long long, long long>, hoge> m;
  for (long long i = 0; i < (long long)(n); i++) {
    pair<long long, long long> p = _div(a[i], b[i]);
    if (m.find(p) == m.end()) {
      m[p] = hoge({0, false});
    }
    m[p].cnt++;
  }
  long long ans = 1;
  for (auto &x : m) {
    if (x.second.check) continue;
    pair<long long, long long> p = x.first;
    pair<long long, long long> q = _div(-p.second, p.first);
    long long d = n;
    long long h = math::pow_mod(2, x.second.cnt, (1000L * 1000L * 1000L + 7L));
    if (m.find(q) != m.end()) {
      auto &y = m[q];
      y.check = true;
      h += math::pow_mod(2, y.cnt, (1000L * 1000L * 1000L + 7L));
      h--;
    }
    ans *= h;
    ans %= (1000L * 1000L * 1000L + 7L);
  }
  ans--;
  cout << ans << endl;
}
signed main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
