#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline void read(long long &x) {
  char ch = getchar();
  int f = 0;
  x = 0;
  while (!isdigit(ch)) {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
  if (f) x = -x;
}
const int N = 2e5 + 10, mod = 1e9 + 7;
long long n, res = 1, c, a[N], b[N];
inline long long gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
map<pair<long long, long long>, int> cnt;
vector<pair<long long, long long> > v;
inline int Pow(int a, int b) {
  int tmp = 1;
  while (b) {
    if (b & 1) tmp = 1ll * tmp * a % mod;
    a = 1ll * a * a % mod, b >>= 1;
  }
  return tmp;
}
signed main() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(a[i]), read(b[i]);
    long long _ = gcd(a[i], b[i]);
    pair<long long, long long> tmp =
        _ ? make_pair(a[i] / _, b[i] / _) : make_pair(a[i], b[i]);
    if (tmp.first < 0) tmp.first = -tmp.first, tmp.second = -tmp.second;
    if ((++cnt[tmp]) == 1 && b[i] > 0) v.push_back(tmp);
  }
  for (int i = 0, a, b; i < v.size(); ++i) {
    pair<long long, long long> tmp = v[i];
    a = cnt[tmp];
    if ((b = cnt[make_pair(tmp.second, -tmp.first)]))
      c += a + b, res = res * (Pow(2, a) + Pow(2, b) - 1) % mod;
  }
  res = (res * Pow(2, n - c) - 1) % mod;
  return printf("%lld\n", res), 0;
}
