#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, int> dir, liv;
long long a[(1 << 20)], b[(1 << 20)];
long long mdc(long long a, long long b) { return b ? mdc(b, a % b) : a; }
long long fastpow(long long b, long long e) {
  long long ans = 1LL;
  for (; e; b = (b * b) % 1000000007, e >>= 1)
    if (e & 1LL) ans = (ans * b) % 1000000007;
  return ans;
}
long long ans, m, n, fator;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = n; i--;) {
    cin >> a[i] >> b[i];
    if (a[i] < 0) {
      a[i] = -a[i];
      b[i] = -b[i];
    }
    m = mdc(abs(a[i]), abs(b[i]));
    a[i] /= m;
    b[i] /= m;
    dir[pair<long long, long long>(a[i], b[i])]++;
  }
  for (auto p : dir) {
    int u = p.first.first, v = p.first.second;
    if (dir.find(pair<long long, long long>(v, -u)) == dir.end() &&
        dir.find(pair<long long, long long>(-v, u)) == dir.end()) {
      ++ans;
    } else {
      liv[pair<long long, long long>(u, v)] =
          dir[pair<long long, long long>(u, v)];
    }
  }
  dir.clear();
  ans = fastpow(2, ans);
  for (auto p : liv) {
    int u = p.first.first, v = p.first.second;
    if (!p.second) continue;
    fator = (fastpow(2, p.second) - 1 + 1000000007) % 1000000007;
    if (v > 0) {
      fator = (fator + fastpow(2, liv[pair<long long, long long>(v, -u)]) +
               1000000007) %
              1000000007;
      liv[pair<long long, long long>(v, -u)] = 0;
    } else {
      fator = (fator + fastpow(2, liv[pair<long long, long long>(-v, u)]) +
               1000000007) %
              1000000007;
      liv[pair<long long, long long>(-v, u)] = 0;
    }
    ans = (ans * fator) % 1000000007;
  }
  cout << (ans - 1 + 1000000007) % 1000000007 << '\n';
  return 0;
}
