#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const long long mod = 1000000007;
const long long INF = 1e15;
const double PI = 3.1415926535897932;
const double LIT = 0.000000000001;
long long yaku(long long a, long long b) {
  if (a > b) return yaku(b, a);
  return b % a ? yaku(b % a, a) : a;
}
map<pair<long long, long long>, long long> d;
void input() {
  long long x, y;
  cin >> x >> y;
  pair<long long, long long> X;
  if (!x) {
    if (!y) return;
    X = make_pair(0, -1);
  }
  if (!y) X = make_pair(1, 0);
  long long K = yaku(abs(x), abs(y));
  if (x < 0) K = -K;
  X = make_pair(x / K, y / K);
  d[X]++;
  return;
}
long long ruijou(long long n, long long k) {
  if (!k) return 1;
  long long a = ruijou(n, k / 2);
  a = (a * a) % mod;
  return k % 2 ? (a * n) % mod : a;
}
pair<long long, long long> tsui(pair<long long, long long> x) {
  return x.second >= 0 ? make_pair(x.second, -x.first)
                       : make_pair(-x.second, x.first);
}
int main() {
  long long N;
  cin >> N;
  for (int i = (int)0; i < (int)N; i++) input();
  long long ans = 1;
  for (auto itr = d.begin(); itr != d.end(); itr++) {
    pair<long long, long long> A = itr->first;
    if (A.second >= 0) {
      pair<long long, long long> B = tsui(A);
      if (d.count(B)) {
        long long kari = ruijou(2, d[B]);
        kari = (kari + mod - 1) % mod;
        kari += ruijou(2, d[A]);
        ans = (ans * kari) % mod;
      } else
        ans = (ans * ruijou(2, d[A])) % mod;
    } else {
      pair<long long, long long> B = tsui(A);
      if (!d.count(B)) ans = (ans * ruijou(2, d[A])) % mod;
    }
  }
  ans = (ans + mod - 1) % mod;
  cout << ans << endl;
}
